Module for declaring Time API.
More...
Module for declaring Time API.
The system time module implements some routines to deal with time (timers). The timer can be started by sys_timer_start(), stopped by sys_timer_stop(), and adjusted after sleep by sys_timer_adjust(). Some information can be acquired by sys_timer_is_started() and sys_time_get(). The correct API for implementing hardware delays is sys_time_delay_us(). Note that the module must be initialized by sys_timers_init() which is done by sys_init().
typedef void(* sys_timer_callback_t)(void *p_data) |
Prototype of the user-defined timer callback.
- Parameters
-
p_data | Pointer to the data, specific for this callback. |
System timer type (one-shot or periodic timer).
Enumerator |
---|
SYS_TIMER_ONESHOT |
The timer is Oneshot
|
SYS_TIMER_PERIODIC |
The timer is Periodic
|
void sys_time_delay_us |
( |
uint32_t |
delay_us | ) |
|
Function for implementing a delay for short hardware delays.
- Warning
- Interrupts are NOT disabled inside this function.
- Parameters
-
[in] | delay_us | Number of microseconds to delay. |
Function for getting the current system time.
- Return values
-
The | current system timer counter value in microseconds. |
Function for checking if input timer has been started.
- Parameters
-
[in] | p_timer | Pointer to a timer. |
- Return values
-
true | p_timer has been started and has not been stopped yet. |
false | p_timer has never been started or already timed out. |
Function for starting the timer.
See the description of sys_timer_t fields for the details on how to program the timer.
- Parameters
-
[in] | p_timer | Pointer to a valid timer descriptor, which is filled by the user, according to sys_timer_t fields description. |
Function for stopping the timer.
This function is used to stop the timer, which was started earlier. After this function is called, the timer will not fire.
- Parameters
-
[in] | p_timer | Pointer to a valid timer descriptor. |