Skip to content

Commit 47dc283

Browse files
AGlass0fMilkArto Kinnunen
authored andcommitted
Fixed IRQ_ENABLE call to IRQ_DISABLE (oops).
1 parent 3b5e68f commit 47dc283

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

usb/device/targets/TARGET_NORDIC/TARGET_MCU_NRF52840/USBPhy_Nordic.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ USBPhyHw::~USBPhyHw() {
6565
}
6666

6767
void USBPhyHw::init(USBPhyEvents *events) {
68-
// Disable IRQ
69-
//NVIC_DisableIRQ(USBD_IRQn);
7068

7169
this->events = events;
7270

@@ -101,8 +99,12 @@ void USBPhyHw::init(USBPhyEvents *events) {
10199
*/
102100
NRF_USBD->ISOINCONFIG |= 0x01; // set RESPONSE to 1 (respond with ZLP)
103101

104-
// Enable IRQ
102+
// Set up the IRQ handler
105103
NVIC_SetVector(USBD_IRQn, (uint32_t)USBD_HAL_IRQHandler);
104+
105+
// Enable the power events
106+
nrfx_power_usbevt_enable();
107+
106108
}
107109

108110
void USBPhyHw::deinit() {
@@ -544,17 +546,13 @@ void USBPhyHw::_reset(void)
544546
void USBPhyHw::enable_usb_interrupts(void) {
545547
// Enable USB and USB-related power interrupts
546548
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();
550550
}
551551

552552
void USBPhyHw::disable_usb_interrupts(void) {
553553
// 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();
558556
}
559557

560558
static void power_usb_event_handler(nrfx_power_usb_evt_t event) {

0 commit comments

Comments
 (0)