mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-01 19:20:35 +00:00
nrf: move power setup out of stack (to application)
This commit is contained in:
parent
6129670e4a
commit
421ae8fc82
@ -177,36 +177,6 @@ static void hfclk_disable(void)
|
|||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
bool tusb_hal_init(void)
|
bool tusb_hal_init(void)
|
||||||
{
|
{
|
||||||
// TODO may move to application
|
|
||||||
|
|
||||||
// USB power may already be ready at this time -> no event generated
|
|
||||||
// We need to execute the handler based on the status
|
|
||||||
uint32_t usb_reg;
|
|
||||||
|
|
||||||
#ifdef SOFTDEVICE_PRESENT
|
|
||||||
if ( is_sd_enabled() )
|
|
||||||
{
|
|
||||||
sd_power_usbdetected_enable(true);
|
|
||||||
sd_power_usbpwrrdy_enable(true);
|
|
||||||
sd_power_usbremoved_enable(true);
|
|
||||||
|
|
||||||
sd_power_usbregstatus_get(&usb_reg);
|
|
||||||
}else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
usb_reg = NRF_POWER->USBREGSTATUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (usb_reg & POWER_USBREGSTATUS_VBUSDETECT_Msk )
|
|
||||||
{
|
|
||||||
tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_DETECTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (usb_reg & POWER_USBREGSTATUS_OUTPUTRDY_Msk )
|
|
||||||
{
|
|
||||||
tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_READY);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user