资源简介
flexitimer2库,arduino计时器中断库文件,适用于颜色识别模块的颜色识别过程中的计时器中断
代码片段和文件信息
/*
FlexiTimer2.h - Using timer2 with a configurable resolution
Wim Leers
based on MsTimer2
Javier Valencia
History:
16/Dec/2011 - Added Teensy/Teensy++ support (bperrybap)
note: teensy uses timer4 instead of timer2
25/April/10 - based on MsTimer2 V0.5 (from 29/May/09)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License or (at your option) any later version.
This library is distributed in the hope that it will be useful
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not write to the Free Software
Foundation Inc. 51 Franklin St Fifth Floor Boston MA 02110-1301 USA
*/
#include
unsigned long FlexiTimer2::time_units;
void (*FlexiTimer2::func)();
volatile unsigned long FlexiTimer2::count;
volatile char FlexiTimer2::overflowing;
volatile unsigned int FlexiTimer2::tcnt2;
void FlexiTimer2::set(unsigned long ms void (*f)()) {
FlexiTimer2::set(ms 0.001 f);
}
/**
* @param resolution
* 0.001 implies a 1 ms (1/1000s = 0.001s = 1ms) resolution. Therefore
* 0.0005 implies a 0.5 ms (1/2000s) resolution. And so on.
*/
void FlexiTimer2::set(unsigned long units double resolution void (*f)()) {
float prescaler = 0.0;
if (units == 0)
time_units = 1;
else
time_units = units;
func = f;
#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega328P__) || defined (__AVR_ATmega1280__) || defined (__AVR_ATmega2560__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
TIMSK2 &= ~(1< TCCR2A &= ~((1< TCCR2B &= ~(1< ASSR &= ~(1< TIMSK2 &= ~(1<
if ((F_CPU >= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64
TCCR2B |= (1< TCCR2B &= ~((1< prescaler = 64.0;
} else if (F_CPU < 1000000UL) { // prescaler set to 8
TCCR2B |= (1< TCCR2B &= ~((1< prescaler = 8.0;
} else { // F_CPU > 16Mhz prescaler set to 128
TCCR2B |= ((1< TCCR2B &= ~(1< prescaler = 128.0;
}
#elif defined (__AVR_ATmega8__)
TIMSK &= ~(1< TCCR2 &= ~((1< TIMSK &= ~(1< ASSR &= ~(1<
if ((F_CPU >= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64
TCCR2 |= (1< TCCR2 &= ~((1< prescaler = 64.0;
} else if (F_CPU < 1000000UL) { // prescaler set to 8
TCCR2 |= (1< TCCR2 &= ~((1< prescaler = 8.0;
} else { // F_CPU > 16Mhz p
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1205 2012-02-14 01:16 flexitimer2库\wimleers-flexitimer2-7338cfb\examples\FlashLed\FlashLed.pde
文件 6515 2012-02-14 01:16 flexitimer2库\wimleers-flexitimer2-7338cfb\FlexiTimer2.cpp
文件 518 2012-02-14 01:16 flexitimer2库\wimleers-flexitimer2-7338cfb\FlexiTimer2.h
文件 63 2012-02-14 01:16 flexitimer2库\wimleers-flexitimer2-7338cfb\keywords.txt
目录 0 2018-12-21 16:25 flexitimer2库\wimleers-flexitimer2-7338cfb\examples\FlashLed
目录 0 2018-12-21 16:25 flexitimer2库\wimleers-flexitimer2-7338cfb\examples
目录 0 2018-12-21 16:25 flexitimer2库\wimleers-flexitimer2-7338cfb
目录 0 2018-12-21 16:25 flexitimer2库
----------- --------- ---------- ----- ----
8301 8
相关资源
- Arduino 超声波库函数
- arduino 读取温湿度dht11
- arduino电子时钟
- 人体检测模块
- arduino 原理图 PCB
- DallasTemperature,OneWire库
- DS1302的Arduino函数库
- MOXA 摩莎公司 串口通讯PComm库文件说明
- 小型飞机票预定系统,源代码+数据库
- TB6600步进电机Arduino控制程序
- Arduino UNO引脚分布图
- 气压传感器SDP810的Arduino控制代码
- arduino软串口库文件SoftwareSerial
- vlc3.0.4 32 位 lib库文件
- Arduino感光灯
- Arduino驱动四线电阻触摸屏代码
- 武术擂台机器人代码arduino
- arduino 5路循迹小车代码
- 基于Arduino的PM2.5和空气湿度检测装置
- 手势识别传感器paj7620 arduino板使用代
- Opengl 开发库, 动态链接库文件,op
- ARDUINO开发板与读卡模块的连接使用
- esp8266可用的28byj、20byj、24byj五线四相
- 全国车牌对应地区数据库文件更新版
- Face-tracking.zip
- Dht11温湿度模块库文件
- LCD12864封装Altium Designer库文件
- Arduino uno+esp8266+onenet+dht11温湿度传感器
- Arduino与LabVIEW互动设计
- 智能小车超声波避障实验+源码(有舵
评论
共有 条评论