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

How to un-initailize nrf power management library?

Hi,

How do i turn off the nrf power management library? Is there any function like nrf_pwr_mgmt_uninit()?

The reason i want to turn it off is because it causes the usbd_msc to detach after a few seconds.

I want the PCA10056 board to run in low power when no USB is connected and in USB MSC mode when the USB is connected.

My current code:

int main(void)
{
ret_code_t ret;
ret = nrf_drv_clock_init();
APP_ERROR_CHECK(ret);

nrf_drv_clock_lfclk_request(NULL);

ret = app_timer_init();
APP_ERROR_CHECK(ret);

ret = usb_detect_init(); // Will need to initialize and un-initialize power management lib here.
APP_ERROR_CHECK(ret);

ret = nrf_pwr_mgmt_init();
APP_ERROR_CHECK(ret);

while (true)
{
if(usb_detect())
{
while (usb_process())
{
/* Nothing to do */
}
/* Sleep CPU only if there was no interrupt since last loop processing */
__WFE();
}
else
{
nrf_pwr_mgmt_run();
}
}
}

Parents Reply Children
Related