This module provides timer scheduling functionality for the 802.15.4 driver.
More...
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:
- CSL,
- Timing out waiting for ACK frames,
- CSMA/CA,
- Inter-frame spacing: SIFS, LIFS (note that AIFS is implemented without using timer module).
- 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 void(* nrf_802154_timer_callback_t)(void *p_context) |
Type of function called when timer fires.
- Parameters
-
[in,out] | p_context | Pointer to user-defined memory location. May be NULL. |
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_timer | Pointer to the timer to start and add to the scheduler. |
[in] | round_up | True if timer should expire after specified time, false if it should expire before. |
Check if given timer is already scheduled.
- Parameters
-
[in] | p_timer | Pointer to the timer to check. |
- Return values
-
true | Given timer is already scheduled. |
false | Given timer is not scheduled. |
Stop given timer and remove it from the scheduler.
- Parameters
-
[in,out] | p_timer | Pointer 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
-
- See also
- nrf_802154_timer_sched_time_get()
- Parameters
-
[in] | t0 | Base of time compared with now . |
[in] | dt | Time delta from t0 compared with now . |
- Return values
-
true | Given time t0 dt is in future (compared to given now ). |
false | Given time t0 dt is not in future (compared to given now ). |