Hi all
I am using nrf52840 kit, and I have a simple BLE app(client/central that turn LED on to a connected server/peripheral) running on it(sdk 15.3). Now I want to put it on deep sleep(SYSTEM OFF) by default. When a button is pushed, then it will connect to the nearby server-peripheral kit and turn the LED on that server.So it is simply that the client will come out of deep sleep only when a button is pushed.
I have looked around for an example to get started with no luck.But so far I have learned that I can use sd_power_system_off() to put it to sleep. Based on my findings I have the following questions
- It seems like I have to prepare to wake up buttons and turn peripherals off, but how do I do this?
- Where do I place the function for deep sleep in Main.c (see code snippet below)?
- Any example that would help me get started, I would greatly appreciate it.
I found this post but still is not that informative
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int main(void)
{
// Initialize.
log_init();
timer_init();
leds_init();
buttons_init();
power_management_init();
ble_stack_init();
gatt_init();
db_discovery_init();
led_service_client_init();
// Start execution.
NRF_LOG_INFO("BLE Lightbulb Remote Control started.");
scan_start();
// Turn on the LED to signal scanning.
bsp_board_led_on(CENTRAL_SCANNING_LED);
// Enter main loop.