TuyaOS
tal_sw_timer.h
浏览该文件的文档.
1
11#ifndef __TAL_SW_TIMER_H__
12#define __TAL_SW_TIMER_H__
13
14#include "tuya_cloud_types.h"
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/***********************************************************************
21 ********************* constant ( macro and enum ) *********************
22 **********************************************************************/
26typedef enum {
27 TAL_TIMER_ONCE = 0,
28 TAL_TIMER_CYCLE,
30
31/***********************************************************************
32 ********************* struct ******************************************
33 **********************************************************************/
34// 定时器ID
35typedef PVOID_T TIMER_ID;
36
37typedef VOID_T (* TAL_TIMER_CB)(TIMER_ID timer_id, VOID_T *arg);
38
39/***********************************************************************
40 ********************* variable ****************************************
41 **********************************************************************/
42
43
44/***********************************************************************
45 ********************* function ****************************************
46 **********************************************************************/
47
57OPERATE_RET tal_sw_timer_init(VOID_T);
58
70OPERATE_RET tal_sw_timer_create(TAL_TIMER_CB func, VOID_T *arg, TIMER_ID *timer_id);
71
81OPERATE_RET tal_sw_timer_delete(TIMER_ID timer_id);
82
92OPERATE_RET tal_sw_timer_stop(TIMER_ID timer_id);
93
103BOOL_T tal_sw_timer_is_running(TIMER_ID timer_id);
104
113OPERATE_RET tal_sw_timer_remain_time_get(TIMER_ID timer_id, UINT32_T *remain_time);
114
126OPERATE_RET tal_sw_timer_start(TIMER_ID timer_id, TIME_MS time_ms, TIMER_TYPE timer_type);
127
137OPERATE_RET tal_sw_timer_trigger(TIMER_ID timer_id);
138
148OPERATE_RET tal_sw_timer_release(VOID_T);
149
160
161
162#ifdef __cplusplus
163}
164#endif
165
166#endif /* __TAL_SW_TIMER_H__ */
167
168
169
170
171
172
173
174
INT_T tal_sw_timer_get_num(VOID_T)
Get timer node currently
OPERATE_RET tal_sw_timer_create(TAL_TIMER_CB func, VOID_T *arg, TIMER_ID *timer_id)
create a software timer
BOOL_T tal_sw_timer_is_running(TIMER_ID timer_id)
Identify the software timer is running
OPERATE_RET tal_sw_timer_start(TIMER_ID timer_id, TIME_MS time_ms, TIMER_TYPE timer_type)
Start the software timer
OPERATE_RET tal_sw_timer_stop(TIMER_ID timer_id)
Stop the software timer
TIMER_TYPE
the type of timer
Definition: tal_sw_timer.h:26
OPERATE_RET tal_sw_timer_release(VOID_T)
Release all resource of the software timer
OPERATE_RET tal_sw_timer_trigger(TIMER_ID timer_id)
Trigger the software timer
OPERATE_RET tal_sw_timer_remain_time_get(TIMER_ID timer_id, UINT32_T *remain_time)
Identify the software timer is running
OPERATE_RET tal_sw_timer_init(VOID_T)
Initializing the software timer
OPERATE_RET tal_sw_timer_delete(TIMER_ID timer_id)
Delete the software timer