📄 timer.h
字号:
/*
* File: timer.h
*
* Purpose: timer routines
*/
#ifndef __TIMER_H__
#define __TIMER_H__
#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif
/*--------------------- Export Definitions ------------------------*/
#define TMR_TICKS_PER_SEC 100 // clock rate is 100 ticks per second
typedef void (* PFN_CALLBACK_TIMER)(PVOID);
/*--------------------- Export Types ------------------------------*/
/*--------------------- Export Macros ------------------------------*/
//
// Calculate the real difference between t1 and t0
// Because t1 maybe wrapped around once.
// (but assume that never wrapped around twice.)
//
#define TMR_u32Diff(t1, t0) ((t1 >= t0) ? (t1 - t0) : (0xFFFFFFFF - t0 + t1 + 1))
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
#if defined(__cplusplus)
extern "C" { /* Assume C declarations for C++ */
#endif // __cplusplus
void TMR_vIsrTimer0(void);
void TMR_vInit(void);
void TMR_vSetHookFunc(PFN_HOOK pfnHook);
UINT32 TMR_u32GetSysTick(void);
INT TMR_iSetTimer(
UINT uTimeToDelay,
PFN_CALLBACK_TIMER pfnTimerCallbackFunc,
PVOID pvTimerCallbackContext);
INT TMR_iSetPeriodicTimer(
UINT uTimeOutPeriod,
PFN_CALLBACK_TIMER pfnTimerCallbackFunc,
PVOID pvTimerCallbackContext);
BOOL TMR_bCancelTimer(UINT idTimer);
BOOL TMR_bCancelAllTimer(void);
#if defined(__cplusplus)
} /* End of extern "C" { */
#endif // __cplusplus
#endif // __TIMER_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -