1.1.4.4.7 DRV_RF215_RxIndCallbackRegister Function
C
void DRV_RF215_RxIndCallbackRegister ( DRV_HANDLE drvHandle, const DRV_RF215_RX_IND_CALLBACK callback, uintptr_t context );
Summary
Allows a client to set an event handling function for the driver to call back when a new PPDU is received.
Description
This function allows a client to register a RF215 receive indication event handling function for the driver to call back when a new PPDU is received.
The callback should be registered immediately after opening the driver. Before this callback is set, any PPDU received by the transceiver will not be notified.
Precondition
DRV_RF215_Open must have been called to obtain a valid opened driver handle.
Parameters
Param | Description |
---|---|
drvHandle | A valid open-instance handle, returned from the driver's open routine. |
callback | Pointer to the callback function. |
context | The value of this parameter will be passed back to the client unchanged, when the callback function is called. |
Returns
None.
Example
static void APP_RxIndCb(DRV_RF215_RX_INDICATION_OBJ* indObj, uintptr_t ctxt) { // The context handle was set to an application specific object // It is now retrievable easily in the event handler MY_APP_OBJ myAppObj = (MY_APP_OBJ *) ctxt; // Reception handling here. } SYS_MODULE_OBJ sysObjDrvRf215; // Returned from DRV_RF215_Initialize SYS_STATUS drvRf215Status; DRV_HANDLE drvRf215Handle; MY_APP_OBJ myAppObj; // Application specific data object drvRf215Status = DRV_RF215_Status(sysObjDrvRf215); if (drvRf215Status == SYS_STATUS_READY) { // This means now the driver can be opened using DRV_RF215_Open routine drvRf215Handle = DRV_RF215_Open(DRV_RF215_INDEX_0, RF215_TRX_ID_RF09); if (drvRf215Handle != DRV_HANDLE_INVALID) { // Driver opened successfully. Register callback DRV_RF215_RxIndCallbackRegister(drvRf215Handle, APP_RxIndCb, (uintptr_t) myAppObj); } }
Remarks
The callback once set, persists until the client closes the driver or sets another callback (which could be a "NULL" pointer to indicate no callback).