Bluetooth/MiraMesh multi stack support¶
Support for Bluetooth low energy in parallel with MiraMesh network on the nRF52 platform.
The Bluetooth/Mira multi stack support makes it possible to have a connection to devices from a mobile phone while the devices still are connected to the MiraMesh network. Making it possible to reconfigure devices on the fly.
Usage¶
To use the multi-stack support, look at the ble
example available in the
distribution.
Bluetooth functionality is available using the nRF5 SoftDevice API. For API documentation, refer to Nordic documentation:
- nRF52832 - S132 documentation
- nRF52840 - S140 documentation
An API to MiraMesh is available for registering an event handler.
Resource sharing¶
Bluetooth and MiraMesh shares the same radio, which means that increased bluetooth activity will reduce performance of the MiraMesh network. Therefore, only bluetooth modes with low radio usage is supported.
Also note that Bluetooth may increase power consumption.
Types¶
mira_nrf_ble_event_handler_t¶
Event handler callback for nrf52 softdevice BLE events.
The event handler should poll for ble events using sd_ble_evt_get()
Enums¶
mira_nrf_lfclk_source_t¶
Source select for nRF low frequency oscillator.
Name | Description |
---|---|
MIRA_NRF_LFCLK_CRYSTAL |
|
MIRA_NRF_LFCLK_EXTERNAL_SOURCE_BYPASS_ENABLED |
|
MIRA_NRF_LFCLK_EXTERNAL_SOURCE_BYPASS_DISABLED |
Structs¶
mira_nrf_clk_config_t¶
Clock configuration struct for nRF.
Name | Type | Description |
---|---|---|
lfclk_source |
mira_nrf_lfclk_source_t |
Functions¶
mira_nrf_clk_init¶
Clock initialization for the nRF platform.
Can only be called once on startup, in the reset handler.
mira_nrf_ble_event_handler_register¶
Register event handler for nRF52 softdevice BLE events.
Parameters¶
Name | Description |
---|---|
evt_handler | event handler |
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | Successfully registered event handler. |
MIRA_ERROR_NOT_SUPPORTED | Operation not supported. |
mira_nrf_hfclk_request¶
Request the HF-clock to turn on.
The clock turns on asynchronously and the callback will be called when it is on. Call mira_nrf_release_hfclk() to turn off the clock when it is no longer needed.
Note
the callback is run from an interrupt service routine.
Parameters¶
Name | Description |
---|---|
callback | called when clock has started. |
storage | passed on to the callback. |
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | Successfully registered the request. |
MIRA_ERROR_RESOURCE_NOT_AVAILABLE | Too many processes are waiting for the clock to turn on. |
mira_nrf_hfclk_release¶
Request the HF-clock to turn off.
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | Successfully registered the request. |
mira_nrf_hfclk_is_running¶
Is the HF-clock running?
Note
The HF-clock can start/stop at any time unless mira_nrf_hfclk_request has been called before.
Return value¶
Name | Description |
---|---|
MIRA_TRUE | when the HF-clock is running. |