#ifndef _PT_TIMER_H_ #define _PT_TIMER_H_ #include #ifndef boolean #define boolean unsigned char #endif #ifndef NULL #define NULL 0 #endif //如果使用__USE_WT_TIMER_ 建议系统滴答10ms为佳 可使用497天后重置计数器 #define __USE_WT_TIMER_ #ifdef __USE_WT_TIMER_ typedef struct _pt_timer_t { volatile uint32_t ms; }pt_timer_t; uint32_t getSysTick(void); #else typedef struct _pt_timer_t { struct _pt_timer_t *next; volatile uint16_t ms; // ³¬Ê±±êÖ¾¡£³¬Ê±Ê±ÉèÖÃΪ 0 volatile uint16_t ticks; }pt_timer_t; #endif void PTTimerInitPool(pt_timer_t *pool); void PTTimerStart(pt_timer_t *pool, pt_timer_t *timer, uint16_t ms); boolean PTTimerIsExpired(pt_timer_t *timer); void PTTimerStop(pt_timer_t *pool, pt_timer_t *timer); void PTTimerTick(pt_timer_t *pool); #endif /* _PT_TIMER_H_ */