I'm implementing a function which enters sleep mode and wakes up by interrupt like below..
void main(void)
{
uart_wifi = device_get_binding("UART_1");
uart_irq_rx_disable(uart_wifi);
uart_irq_callback_set(uart_wifi, uart_cb); // Set UART interrupt callback
uart_irq_rx_enable(uart_wifi);
while (1) {
printk("enter sleep\r\n");
__WFI();
printk("wake up\r\n");
}
}
Is this correct way to enter sleep mode? Do you know any other better ways to do it?
In the nRF52 series case, it seems that you can use nrf_pwr_mgmt_run() function.
https://devzone.nordicsemi.com/f/nordic-q-a/34584/wfe-wfi-and-systemon-mode-differences