diff --git a/lib/tinyusb b/lib/tinyusb index f25cf35..03d442a 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit f25cf35634650dabc9fdd493eb563f2c88299b3e +Subproject commit 03d442a86124d759f294828b46ad134f3e2f18dc diff --git a/src/main.c b/src/main.c index 4b19afb..7c98f58 100644 --- a/src/main.c +++ b/src/main.c @@ -602,11 +602,22 @@ uint32_t proc_soc(void) if (NRF_SUCCESS == err) { - // from hal_nrf5x.c - extern void power_usb_event_handler(uint32_t evt); - pstorage_sys_event_handler(soc_evt); - power_usb_event_handler(soc_evt); + + /*------------- usb power event handler -------------*/ + extern void tusb_hal_nrf_power_event(uint32_t evt); + enum // TODO remove when migrating to SDK15 + { + NRFX_POWER_USB_EVT_DETECTED = 0, + NRFX_POWER_USB_EVT_REMOVED, + NRFX_POWER_USB_EVT_READY + }; + + int32_t usbevt = (soc_evt == NRF_EVT_POWER_USB_DETECTED ) ? NRFX_POWER_USB_EVT_DETECTED: + (soc_evt == NRF_EVT_POWER_USB_POWER_READY) ? NRFX_POWER_USB_EVT_READY : + (soc_evt == NRF_EVT_POWER_USB_REMOVED ) ? NRFX_POWER_USB_EVT_REMOVED : -1; + + if ( usbevt >= 0) tusb_hal_nrf_power_event(usbevt); } return err;