T-Box Basic dev
Loading...
Searching...
No Matches
sys_timer.h File Reference

系统定时器接口 More...

#include "tbox/time.h"

Go to the source code of this file.

Data Structures

struct  sys_timer_info_t
struct  sys_timer_task_info_t

Macros

#define SYS_TIMER_TASK_NAME_MAX   25
#define SYS_TIMER_TASK_TOTAL_MAX   10
#define SYS_TIMER_TASK_PARA_MAX   50

Functions

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只允许一个定时任务
int sys_timer_del_task (const char *task_name)
 删除定时任务
const sys_timer_info_tsys_timer_get_task (const char *task_name)
 查询定时任务
void sys_timer_task_proc (void)
 定时任务处理(每秒调用)
int sys_timer_init (void)
 定时任务初始化

Detailed Description

系统定时器接口

Version
1.0.0
Date
2026-07-03

Function Documentation

◆ sys_timer_add_task()

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只允许一个定时任务

Parameters
task_name任务名称
date_time定时时间,week_bit低7位为星期掩码(bit0=周日…bit6=周六),全零为一次性任务,bit7=1为周期任务
para_data回调参数,可以为NULL
para_len参数长度
Returns
0成功,-1失败

◆ sys_timer_del_task()

int sys_timer_del_task ( const char * task_name)

删除定时任务

Parameters
task_name任务名称
Returns
0成功,-1失败

◆ sys_timer_get_task()

const sys_timer_info_t * sys_timer_get_task ( const char * task_name)

查询定时任务

Parameters
task_name任务名称
Returns
定时任务指针,NULL表示不存在

◆ sys_timer_init()

int sys_timer_init ( void )

定时任务初始化

Returns
0成功,-1失败