|
LDL
0.5.0
|
MAC accesses various things through system interfaces which must be passed as function pointers to MAC during LDL_MAC_init().
The interfaces are:
In addition to function pointers, the following macros MUST be defined if LDL_MAC_radioEvent(), LDL_MAC_radioEventWithTicks(), or LDL_MAC_ticksUntilNextEvent() are called from an interrupt:
Macros | |
| #define | LDL_SYSTEM_ENTER_CRITICAL(APP) |
| #define | LDL_SYSTEM_LEAVE_CRITICAL(APP) |
Typedefs | |
| typedef uint32_t(* | ldl_system_ticks_fn) (void *app) |
| typedef uint32_t(* | ldl_system_rand_fn) (void *app) |
| typedef uint8_t(* | ldl_system_get_battery_level_fn) (void *app) |
| #define LDL_SYSTEM_ENTER_CRITICAL | ( | APP | ) |
Expanded inside functions which might be called from both mainloop and interrupt. At the moment only LDL_MAC_ticksUntilNextEvent() and LDL_MAC_interrupt() are safe to call this way.
Always paired with LDL_SYSTEM_LEAVE_CRITICAL within the same function like so:
If you are using avr-libc:
If you are using CMSIS:
| [in] | APP | from ldl_mac_init_arg.app |
| #define LDL_SYSTEM_LEAVE_CRITICAL | ( | APP | ) |
Expanded inside functions which might be called from both mainloop and interrupt.
Always paired with LDL_SYSTEM_ENTER_CRITICAL within the same function.
| [in] | APP | from ldl_mac_init_arg.app |
| typedef uint32_t(* ldl_system_ticks_fn) (void *app) |
This function reads a free-running 32 bit counter. The counter is expected to increment at a rate of ldl_mac_init_arg.tps ticks per second.
LDL uses this changing value to track of the passage of time and perform scheduling.
If you intend to keep LDL running in deep sleep modes, make sure that the timer continues to increment in this mode.
| [in] | app | from ldl_mac_init_arg.app |
| typedef uint32_t(* ldl_system_rand_fn) (void *app) |
LDL uses this function to select channels and to add random dither to scheduled events.
| [in] | app | from ldl_mac_init_arg.app |
| (0..UINT32_MAX) |
| typedef uint8_t(* ldl_system_get_battery_level_fn) (void *app) |
LDL uses this function to discover the battery level for for device status MAC command.
| [in] | app | from ldl_mac_init_arg.app |
| 255 | not implemented |