MPLAB Harmony Bluetooth Help
|
For the application to start using an instance of the module, it must call the DRV_BM71_Open function which provides a driver handle to the BM71 Bluetooth driver instance.
|
Note: |
It is necessary to check the status of driver initialization before opening a driver instance. The status of the BM71 Bluetooth Driver can be known by calling DRV_BM71_Status. |
Example:
case BLE_STATE_OPEN: { if (SYS_STATUS_READY == DRV_BT_Status()) { // open BT module bleData.bt.handle = DRV_BT_Open(DRV_IO_INTENT_READ, DRV_BT_PROTOCOL_BLE); if(bleData.bt.handle != DRV_HANDLE_INVALID) { bleData.state = BLE_STATE_SET_BT_EVENT_HANDLER; } } break;
Event handlers are functions in the user’s code that are used as callbacks from the driver when something occurs that the client needs to know about.
The function DRV_BM71_EventHandlerSet is called by a client to identify a general event handling function for the driver to call back. The prototype for the callback is defined by DRV_BM71_EVENT_HANDLER. For BLE applications, the callback will be called for events such as DRV_BT_EVENT_BLESPP_MSG_RECEIVED and DRV_BT_EVENT_BLE_STATUS_CHANGED.
Example:
case BLE_STATE_SET_BT_EVENT_HANDLER: { DRV_BT_EventHandlerSet(bleData.bt.handle, bleData.bt.eventHandler, (uintptr_t)0); bleData.state = BLE_STATE_INIT_DONE; } break;
MPLAB Harmony Bluetooth Help
|