timer.h
来自「LCD using AVR controller」· C头文件 代码 · 共 55 行
H
55 行
/* Timer.h
*
* Accurate timing.
*
* #define one of the following values to select the appropriate code
* based on your microcontroller and desired Timer/Counter (T/C) usage.
*
* define T/C
* --------- ---
* TIMER_0 0
* TIMER_2 2
*
* Valid combinations:
*
* ATmega CLOCK_ T/C
* ------ ------- ----
* 8 8M, 16M 2
* 16, 32 8M 0, 2
* 16M 2
* 644 8M 0, 2
* 16M 2
* 128 8M 0, 2
* 16M 0
*
* Revisions:
* 07-13-06 included in LCDSample project
* 07-05-06 version 1 in master library
*
* Written by Cathy Saxton
* robotics@idleloop.com
*/
#pragma once
class TIMER
{
public:
/* constructor for initializing Timer/Counter for timing */
TIMER();
/* returns number of ms since Timer initialized */
ulong MsCur() const;
/* returns true if the specified number of milliseconds
has passed since the start time (else returns false) */
bool FElapsed(ulong msStart, ulong msWait) const;
/* pauses (waits) for the specified number of milliseconds */
void WaitMs(uint ms) const;
private:
static void Init();
/* static variable: one per class, not instance */
static bool s_fInit;
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?