Callback events¶
The RF core generates multiple interrupts during command execution. The RF driver maps these interrupts to callback events that execute in softare interrupt context. Callback events are divided into 3 groups:
- Generic events, defined for all radio operation commands and originating on the RF core. These are RF_EventCmdDone and RF_EventLastCmdDone as shown in Figure 16.. Both events indicate the termination of a radio operation command and are always generated at the same time.
- Generic events, defined for all radio operation commands and originating in the RF driver. These are explained in the RF driver API documentation.
- Command-specific events, explained in the RF commands reference for
each command. These events occur during the
ACTIVE
phase. An example for CMD_PROP_RX is given below in Figure 16..
Note that all callback events execute in software interrupt context. Whether
they are really executed or not, depends on the bmEvent
parameter in
RF_postCmd() or RF_runCmd(). The following
code snippet gives an example for CMD_PROP_RX:
// Run a CMD_PROP_RX and register a callback for RF_EventCmdDone and RF_EventRxEntryDone
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRx, RF_PriorityNormal, &rxCallback,
RF_EventCmdDone | RF_EventRxEntryDone);
// RX callback handler
// Multiple events might occur at the same time.
void rxCallback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
{
if (e & RF_EventRxEntryDone)
{
// Do something, for instance post a semaphore.
}
if (e & RF_EventCmdDone)
{
// Do something
}
}