This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Difficulty in use of sd_power_system_off function

Hi,

In my project, I use button for put on the microcontroller in sleep mode. I implemented one timer that when I press more of 5 second the button, the micro call sleep_mode_enter function.

This part worked how I want.

Now, I want that the microcontroller to only exit sleep mode if I press the button for more of 5 seconds but the best I got was exit when I press in button.

Can you help me with one code example?

My sleep_mode_enter function is how shown below.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
static void sleep_mode_enter(void)
{
ret_code_t err_code;
nrf_gpio_cfg_output(11);
uint32_t pinbutton = bsp_board_pin_to_button_idx(15);
nrf_gpio_pin_write(11,0);
err_code = bsp_indication_set(BSP_INDICATE_IDLE);
APP_ERROR_CHECK(err_code);
err_code = bsp_wakeup_button_enable(pinbutton);
APP_ERROR_CHECK(err_code);
err_code = sd_power_system_off();
APP_ERROR_CHECK(err_code);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX