@@ -65,8 +65,6 @@ USBPhyHw::~USBPhyHw() {
65
65
}
66
66
67
67
void USBPhyHw::init (USBPhyEvents *events) {
68
- // Disable IRQ
69
- // NVIC_DisableIRQ(USBD_IRQn);
70
68
71
69
this ->events = events;
72
70
@@ -101,8 +99,12 @@ void USBPhyHw::init(USBPhyEvents *events) {
101
99
*/
102
100
NRF_USBD->ISOINCONFIG |= 0x01 ; // set RESPONSE to 1 (respond with ZLP)
103
101
104
- // Enable IRQ
102
+ // Set up the IRQ handler
105
103
NVIC_SetVector (USBD_IRQn, (uint32_t )USBD_HAL_IRQHandler);
104
+
105
+ // Enable the power events
106
+ nrfx_power_usbevt_enable ();
107
+
106
108
}
107
109
108
110
void USBPhyHw::deinit () {
@@ -544,17 +546,13 @@ void USBPhyHw::_reset(void)
544
546
void USBPhyHw::enable_usb_interrupts (void ) {
545
547
// Enable USB and USB-related power interrupts
546
548
NRFX_IRQ_ENABLE (USBD_IRQn);
547
- nrf_power_int_enable (NRF_POWER_INT_USBDETECTED_MASK |
548
- NRF_POWER_INT_USBREMOVED_MASK |
549
- NRF_POWER_INT_USBPWRRDY_MASK);
549
+ nrfx_power_usbevt_enable ();
550
550
}
551
551
552
552
void USBPhyHw::disable_usb_interrupts (void ) {
553
553
// Disable USB and USB-related power interrupts
554
- NRFX_IRQ_ENABLE (USBD_IRQn);
555
- nrf_power_int_disable (NRF_POWER_INT_USBDETECTED_MASK |
556
- NRF_POWER_INT_USBREMOVED_MASK |
557
- NRF_POWER_INT_USBPWRRDY_MASK);
554
+ NRFX_IRQ_DISABLE (USBD_IRQn);
555
+ nrfx_power_usbevt_disable ();
558
556
}
559
557
560
558
static void power_usb_event_handler (nrfx_power_usb_evt_t event) {
0 commit comments