Timer

RTOS timer functions. More...

Functions

gos_result_t gos_rtos_timer_init (gos_timer_t *timer, uint32_t period_ms, gos_timer_handler_t callback, void *arg)
Initializes a RTOS timer. More...
gos_result_t gos_rtos_timer_deinit (gos_timer_t *timer)
De-initialise a RTOS timer. More...
gos_result_t gos_rtos_timer_start (gos_timer_t *timer)
Starts a RTOS timer running. More...
gos_result_t gos_rtos_timer_stop (gos_timer_t *timer)
Stops a running RTOS timer. More...
gos_result_t gos_rtos_timer_update (gos_timer_t *timer, uint32_t period_ms)
Update timer's period. More...
gos_result_t gos_rtos_timer_is_running (gos_timer_t *timer)
Check if an RTOS timer is running. More...

Detailed Description

RTOS timer functions.

Function Documentation

gos_rtos_timer_deinit()

gos_result_t gos_rtos_timer_deinit ( gos_timer_t * timer )

De-initialise a RTOS timer.

Deletes a RTOS timer created with gos_rtos_timer_init()

Note
This will automatically stop the timer if it's actively running.
Parameters
[in] timer : Pointer to the RTOS timer handle
Returns
Result of API call, gos_result_t

gos_rtos_timer_init()

gos_result_t gos_rtos_timer_init ( gos_timer_t * timer,
uint32_t period_ms,
gos_timer_handler_t callback,
void * arg
)

Initializes a RTOS timer.

Initialises a periodic RTOS timer.

Note
Timer does not start running until gos_rtos_timer_start() is called.
The timer callback runs in a high priority context. For this reason, it is extremely important to NOT specify too small of a period_ms . A small period_ms places a large overhead on the system which may cause it to become unstable. Periods greater than 100 milliseconds are recommended.
Parameters
[in] timer : Pointer to the timer handle to be initialised
[in] period_ms : Timer period in milliseconds
[in] callback : Callback function that is called each time the timer expires
[in] arg : Argument that will be passed to the callback function
Returns
Result of API call, gos_result_t

gos_rtos_timer_is_running()

gos_result_t gos_rtos_timer_is_running ( gos_timer_t * timer )

Check if an RTOS timer is running.

This returns GOS_SUCCESS if the timer is running. It return GOS_ERROR if the timer is NOT running.

Parameters
[in] timer : Pointer to the RTOS timer handle
Returns
Result of API call, gos_result_t

gos_rtos_timer_start()

gos_result_t gos_rtos_timer_start ( gos_timer_t * timer )

Starts a RTOS timer running.

Starts a RTOS timer running. Timer must have been previously initialised with gos_rtos_timer_init()

Note
If the timer is already running, this will effectively restart the timer.
Parameters
[in] timer : Pointer to the timer handle to start
Returns
Result of API call, gos_result_t

gos_rtos_timer_stop()

gos_result_t gos_rtos_timer_stop ( gos_timer_t * timer )

Stops a running RTOS timer.

Stops a running RTOS timer. Timer must have been previously started with gos_rtos_timer_start()

Parameters
[in] timer : Pointer to the timer handle to stop
Returns
Result of API call, gos_result_t

gos_rtos_timer_update()

gos_result_t gos_rtos_timer_update ( gos_timer_t * timer,
uint32_t period_ms
)

Update timer's period.

This updates a timer's period.

Note
If the timer is actively running then this restarts the timer.
Parameters
[in] timer : Pointer to the timer handle to update
[in] period_ms : Timer's new period in milliseconds
Returns
Result of API call, gos_result_t