ESP8266_RTOS_SDK v1.4.0

- Main Page
- Modules
- Data Structures
- Files

Functions
Software timer APIs

Software timer APIs. More...

## Functions
void | os_timer_setfn (os_timer_t *ptimer, os_timer_func_t *pfunction, void *parg)
| Set the timer callback function. More...
void | os_timer_arm (os_timer_t *ptimer, uint32 msec, bool repeat_flag)
| Enable the millisecond timer. More...
void | os_timer_disarm (os_timer_t *ptimer)
| Disarm the timer. More...

## Detailed Description

Software timer APIs.

Timers of the following interfaces are software timers. Functions of the timers are executed during the tasks. Since a task can be stopped, or be delayed because there are other tasks with higher priorities, the following os_timer interfaces cannot guarantee the precise execution of the timers.

- For the same timer, os_timer_arm (or os_timer_arm_us) cannot be invoked repeatedly. os_timer_disarm should be invoked first.
- os_timer_setfn can only be invoked when the timer is not enabled, i.e., after os_timer_disarm or before os_timer_arm (or os_timer_arm_us).

## Function Documentation

void os_timer_arm | ( | os_timer_t * | ptimer,
|  | uint32 | msec,
|  | bool | repeat_flag
| ) |  |

Enable the millisecond timer.

Parameters

  os_timer_t | *ptimer : timer structure
  uint32_t | milliseconds : Timing, unit: millisecond, range: 5 ~ 0x68DB8
  bool | repeat_flag : Whether the timer will be invoked repeatedly or not

Returns
  null

void os_timer_disarm | ( | os_timer_t * | ptimer | ) |

Disarm the timer.

Parameters

  os_timer_t | *ptimer : Timer structure

Returns
  null

void os_timer_setfn | ( | os_timer_t * | ptimer,
|  | os_timer_func_t * | pfunction,
|  | void * | parg
| ) |  |

Set the timer callback function.

Attention
  1. The callback function must be set in order to enable the timer.
  2. Operating system scheduling is disabled in timer callback.

Parameters

  os_timer_t | *ptimer : Timer structure
  os_timer_func_t | *pfunction : timer callback function
  void | *parg : callback function parameter

Returns
  null