I am really new at working with Bluetooth and the various protocols contained within.
I am using SDK 17.0 and drivers 2.7. I am working on a DK-52 board.
I am working with the HRM Demo. In particular with the battery service timed event. I came across the place in the code where the device will go in to sleep mode. The comments say it should not come back until a button is pushed to wake it up or a reset / powerup occurs.
//---------------------------------------------------------------------------
/**@brief Function for putting the chip into sleep mode.
*
* @note This function will not return.
*/
//---------------------------------------------------------------------------
static void sleep_mode_enter(void)
{
ret_code_t err_code;
err_code = bsp_indication_set(BSP_INDICATE_IDLE);
APP_ERROR_CHECK(err_code);
// Prepare wakeup buttons.
err_code = bsp_btn_ble_sleep_mode_prepare();
APP_ERROR_CHECK(err_code);
// Go to system-off mode (this function will not return; wakeup will cause a reset).
err_code = sd_power_system_off();
APP_ERROR_CHECK(err_code);
}
I never use the buttons on the DK board and from what I am seeing the battery service sends out battery information every couple of seconds. After so many bursts of information, it appears the device somehow just resets itself and continues the process all over again.
If I wanted to keep the system on, full ram retention and wake on any event, which sd function would I need to call so that I could go into Ultra-low power mode and not lose the bonding information with the client app? Is there a demo that demonstrates this type of low power mode that I could look at?
Is there a good method that I could use to determine if the client app was bonded with the device and not send battery level info but wait until a bond occurs and then send that battery info across so as not to waste much battery power as well?
Thanks in advance.
Allen Shea