|
aos_status_t | aos_timer_create (aos_timer_t *timer, void(*fn)(void *, void *), void *arg, uint32_t ms, uint32_t options) |
|
void | aos_timer_free (aos_timer_t *timer) |
|
aos_status_t | aos_timer_start (aos_timer_t *timer) |
|
aos_status_t | aos_timer_stop (aos_timer_t *timer) |
|
aos_status_t | aos_timer_change (aos_timer_t *timer, uint32_t ms) |
|
aos_status_t | aos_timer_change_once (aos_timer_t *timer, uint32_t ms) |
|
bool | aos_timer_is_valid (aos_timer_t *timer) |
|
aos_status_t | aos_timer_new (aos_timer_t *timer, void(*fn)(void *, void *), void *arg, uint32_t ms, bool repeat) |
|
aos_status_t | aos_timer_new_ext (aos_timer_t *timer, void(*fn)(void *, void *), void *arg, uint32_t ms, bool repeat, bool autorun) |
|
提供AliOS Things系统内核定时器功能的基础API.
◆ AOS_TIMER_AUTORUN
#define AOS_TIMER_AUTORUN 0x01u |
表示定时器创建后即启动,当调用aos_timer_create()创建定时器时,用来指定option参数
在文件 kernel.h 第 76 行定义.
◆ AOS_TIMER_NONE
#define AOS_TIMER_NONE 0x0u |
表示不指定任意选项,当调用aos_timer_create()创建定时器时,用来指定option参数
在文件 kernel.h 第 75 行定义.
◆ AOS_TIMER_REPEAT
#define AOS_TIMER_REPEAT 0x02u |
表示定时器是周期性的,当调用aos_timer_create()创建定时器时,用来指定option参数
在文件 kernel.h 第 77 行定义.
◆ aos_timer_t
◆ aos_timer_change()
This function will change attributes of a timer.
- 参数
-
[in] | timer | pointer to the timer. |
[in] | ms | ms of the timer triger. |
- 注解
- change the timer attributes should follow the sequence as timer_stop->timer_change->timer_start
- 返回
- 0: success.
◆ aos_timer_change_once()
This function will change attributes of a timer once.
- 参数
-
[in] | timer | pointer to the timer. |
[in] | ms | ms of the timer triger. |
- 注解
- change the timer attributes should follow the sequence as timer_stop->timer_change->timer_start
- 返回
- 0: success.
◆ aos_timer_create()
aos_status_t aos_timer_create |
( |
aos_timer_t * |
timer, |
|
|
void(*)(void *, void *) |
fn, |
|
|
void * |
arg, |
|
|
uint32_t |
ms, |
|
|
uint32_t |
options |
|
) |
| |
This function will create a timer.
- 参数
-
[in] | timer | pointer to the timer. |
[in] | fn | callbak of the timer. |
[in] | arg | the argument of the callback. |
[in] | ms | ms of the normal timer triger. |
[in] | options | option settings, can be set to AOS_TIMER_AUTORUN|AOS_TIMER_REPEAT |
- 注解
- fn first arg: timer->hdl, not aos_timer_t *timer; second arg: user param arg.
- 返回
- 0: success.
◆ aos_timer_free()
This function will delete a timer.
- 参数
-
[in] | timer | pointer to a timer. |
◆ aos_timer_is_valid()
This function will check if timer is valid. Deprecated, not Recommended.
- 参数
-
[in] | timer | pointer to the timer. |
- 返回
- false: invalid, true: valid.
◆ aos_timer_new()
aos_status_t aos_timer_new |
( |
aos_timer_t * |
timer, |
|
|
void(*)(void *, void *) |
fn, |
|
|
void * |
arg, |
|
|
uint32_t |
ms, |
|
|
bool |
repeat |
|
) |
| |
This function will create a timer and run auto. Deprecated, not Recommended.
- 参数
-
[in] | timer | pointer to the timer. |
[in] | fn | callbak of the timer. |
[in] | arg | the argument of the callback. |
[in] | ms | ms of the normal timer triger. |
[in] | repeat | repeat or not when the timer is created. |
- 注解
- fn first arg: timer->hdl, not aos_timer_t *timer; second arg: user param arg.
- 返回
- 0: success.
◆ aos_timer_new_ext()
aos_status_t aos_timer_new_ext |
( |
aos_timer_t * |
timer, |
|
|
void(*)(void *, void *) |
fn, |
|
|
void * |
arg, |
|
|
uint32_t |
ms, |
|
|
bool |
repeat, |
|
|
bool |
autorun |
|
) |
| |
This function will create a timer. Deprecated, not Recommended.
- 参数
-
[in] | timer | pointer to the timer. |
[in] | fn | callbak of the timer. |
[in] | arg | the argument of the callback. |
[in] | ms | ms of the normal timer triger. |
[in] | repeat | repeat or not when the timer is created. |
[in] | autorun | auto run. |
- 注解
- fn first arg: timer->hdl, not aos_timer_t *timer; second arg: user param arg.
- 返回
- 0: success.
◆ aos_timer_start()
This function will start a timer.
- 参数
-
[in] | timer | pointer to the timer. |
- 返回
- 0: success.
◆ aos_timer_stop()
This function will stop a timer.
- 参数
-
[in] | timer | pointer to the timer. |
- 返回
- 0: success.