T-Box Basic dev
Loading...
Searching...
No Matches
sys_timer.h
Go to the documentation of this file.
1
10#ifndef SYS_TIMER_H
11#define SYS_TIMER_H
12
13#ifdef __cplusplus
14extern "C"
15{
16#endif
17
18#include "tbox/time.h"
19
20/* 定时器任务容量 */
21#define SYS_TIMER_TASK_NAME_MAX 25
22#define SYS_TIMER_TASK_TOTAL_MAX 10
23#define SYS_TIMER_TASK_PARA_MAX 50
24
25#pragma pack(1)
26typedef struct
27{
28 char task_name[SYS_TIMER_TASK_NAME_MAX + 1];
29 tbox_time_info_t date_time;
30 uint8_t para_data[SYS_TIMER_TASK_PARA_MAX];
31 uint32_t para_len;
33#pragma pack()
34
35// 定时任务信息
36typedef struct
37{
38 pthread_mutex_t mutex;
39 sys_timer_info_t timer_info[SYS_TIMER_TASK_TOTAL_MAX];
40 uint64_t last_exe_time[SYS_TIMER_TASK_TOTAL_MAX];
42
51int sys_timer_add_task(const char* task_name, tbox_time_info_t* date_time, uint8_t* para_data, uint32_t para_len);
52
58int sys_timer_del_task(const char* task_name);
59
65const sys_timer_info_t* sys_timer_get_task(const char* task_name);
66
71
77
78#ifdef __cplusplus
79}
80#endif
81
82#endif /* SYS_TIMER_H */
Definition sys_timer.h:27
Definition sys_timer.h:37
Definition time.h:29
int sys_timer_add_task(const char *task_name, tbox_time_info_t *date_time, uint8_t *para_data, uint32_t para_len)
添加定时任务(绝对时间),每个task_name只允许一个定时任务
void sys_timer_task_proc(void)
定时任务处理(每秒调用)
int sys_timer_init(void)
定时任务初始化
const sys_timer_info_t * sys_timer_get_task(const char *task_name)
查询定时任务
int sys_timer_del_task(const char *task_name)
删除定时任务
T-Box 时间工具接口