nRF5 SDK for Thread and Zigbee v1.0.0
Choose documentation:
Timer Scheduler module for the 802.15.4 driver

This module provides timer scheduling functionality for the 802.15.4 driver. More...

Data Structures

struct  nrf_802154_timer_s
 Structure containing timer data used by timer module. More...
 

Typedefs

typedef void(* nrf_802154_timer_callback_t )(void *p_context)
 Type of function called when timer fires. More...
 
typedef struct nrf_802154_timer_s nrf_802154_timer_t
 Type for driver instance.
 

Functions

void nrf_802154_timer_sched_init (void)
 Initialize the timer scheduler.
 
void nrf_802154_timer_sched_deinit (void)
 Deinitialize the timer scheduler.
 
uint32_t nrf_802154_timer_sched_time_get (void)
 Get current time. More...
 
bool nrf_802154_timer_sched_time_is_in_future (uint32_t now, uint32_t t0, uint32_t dt)
 Check if given time is in future. More...
 
void nrf_802154_timer_sched_add (nrf_802154_timer_t *p_timer, bool round_up)
 Start given timer and add it to the scheduler. More...
 
void nrf_802154_timer_sched_remove (nrf_802154_timer_t *p_timer)
 Stop given timer and remove it from the scheduler. More...
 
bool nrf_802154_timer_sched_is_running (nrf_802154_timer_t *p_timer)
 Check if given timer is already scheduled. More...
 

Detailed Description

This module provides timer scheduling functionality for the 802.15.4 driver.

Timer module should be used to implement strict timing features specified in IEEE 802.15.4 like:

Note
Current implementation supports only single one-shot timer. It may be extended to support timer scheduling and repetitive timers if needed.

Timer Scheduler module for the 802.15.4 driver.

Typedef Documentation

typedef void(* nrf_802154_timer_callback_t)(void *p_context)

Type of function called when timer fires.

Parameters
[in,out]p_contextPointer to user-defined memory location. May be NULL.

Function Documentation

void nrf_802154_timer_sched_add ( nrf_802154_timer_t p_timer,
bool  round_up 
)

Start given timer and add it to the scheduler.

Note
Fields t0, dt, callback and p_context should be filled in p_timer prior to calling this function; callback field cannot be NULL.
Due to timer granularity the callback function cannot be called exactly at specified time. Use round_up to specify if given timer should be expired before or after time given in the p_timer structure. The dt field of the p_timer is updated with the rounded up value.
Parameters
[in,out]p_timerPointer to the timer to start and add to the scheduler.
[in]round_upTrue if timer should expire after specified time, false if it should expire before.
bool nrf_802154_timer_sched_is_running ( nrf_802154_timer_t p_timer)

Check if given timer is already scheduled.

Parameters
[in]p_timerPointer to the timer to check.
Return values
trueGiven timer is already scheduled.
falseGiven timer is not scheduled.
void nrf_802154_timer_sched_remove ( nrf_802154_timer_t p_timer)

Stop given timer and remove it from the scheduler.

Parameters
[in,out]p_timerPointer to the timer to stop and remove from the scheduler.
uint32_t nrf_802154_timer_sched_time_get ( void  )

Get current time.

This function is useful to set base time in

See also
nrf_802154_timer_t structure.
Returns
Current time in microseconds [us].
bool nrf_802154_timer_sched_time_is_in_future ( uint32_t  now,
uint32_t  t0,
uint32_t  dt 
)

Check if given time is in future.

Parameters
[in]nowCurrent time.
See also
nrf_802154_timer_sched_time_get()
Parameters
[in]t0Base of time compared with now.
[in]dtTime delta from t0 compared with now.
Return values
trueGiven time t0 dt is in future (compared to given now).
falseGiven time t0 dt is not in future (compared to given now).