I hope that someone can show a clear example of this. I surprised that it isn't in the SDK examples. Basically, it is necessary to stop the BLE SD, in most low-power examples (if your device is to sleep correctly) then an example should show this clearly. One shouldn't have to hunt around for such a simple thing as turning itself off!
There should be an example of start and stop that works in the SDK. Ok. Enough of the rant.
I'm trying to shut down the BLE, and have cobbled together numerous examples. Right now the following function is being run
void bluetooth_sleep(void)
{
uint32_t err_code;
// If connected, disconnect
if (m_conn_handle != BLE_CONN_HANDLE_INVALID)
{
err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
if (err_code != NRF_SUCCESS) {sprintf(outputString,">>ble disconnect failed\r\n");SEGGER_RTT_WriteString(0,outputString);}
}
// Stop advertising
err_code = sd_ble_gap_adv_stop(m_conn_handle); // WHAT PARAMETERS TO PASS HERE????
if (err_code != NRF_SUCCESS) {sprintf(outputString,">>ble adv stop failed\r\n");SEGGER_RTT_WriteString(0,outputString);}
// Disable the radio tasks as scytulip suggested
// devzone.nordicsemi.com/.../
NRF_RADIO-> POWER =0;
NRF_RADIO->TASKS_DISABLE =1;
}
But this returns 00> <error> app: SOFTDEVICE: INVALID MEMORY ACCESS in the RTT.
I think that the parameters that are being passed are wrong, but because all the structures for the GATT advertising is run in macros, it is outside my source code...
