Configure Sleep Mode
Users can configure the Sleep Mode flexibly according to the sleep policy, to ensure fast response and low power consumption of the system.
Take the project, ble_app_pcs, as an example; its main() function basically meets demands for general low-power applications. Users can control the sleep policy by pwr_mgmt_schedule() function. The code snippet of the main() function is as follows.
int main(void)
{
// Initialize user peripherals.
app_periph_init();
// Initialize ble stack.
ble_stack_init(&s_app_ble_callback, &heaps_table);
if (is_enter_ultra_deep_sleep())
{
pwr_mgmt_ultra_sleep(0);
}
// Loop
while (1)
{
pwr_mgmt_schedule();
}
}
Note:
Name: main.c
Path: SDK_Folder\projects\ble\ble_peripheral\ble_app_pcs\Src\user\