35 lines
662 B
C
35 lines
662 B
C
#ifndef APP_FRM_TIMER_H
|
|
#define APP_FRM_TIMER_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define MAX_TIMERS 100 // 定义最大定时器数量
|
|
|
|
// 定时器结构体定义
|
|
typedef struct Timer {
|
|
uint32_t target_time;
|
|
uint32_t elapsed_time;
|
|
uint32_t start_time;
|
|
unsigned char active;
|
|
unsigned char priority;
|
|
struct Timer *next;
|
|
} Timer;
|
|
|
|
// 函数声明
|
|
void timerInit(Timer *timer);
|
|
void timerStart(Timer *timer, uint32_t target_time, unsigned char priority);
|
|
void timerStop(Timer *timer);
|
|
void timerUpdateAll(void);
|
|
uint32_t getCurrentTimerCount(void);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // APP_FRM_TIMER_H
|