Fixed IRQ_ENABLE call to IRQ_DISABLE (oops).

pull/10689/head
George Beckstein 2019-03-14 22:00:40 -04:00 committed by aglass0fmilk
parent 1ab27aff1f
commit 0fd7dcaa4e
1 changed files with 8 additions and 10 deletions

View File

@ -65,8 +65,6 @@ USBPhyHw::~USBPhyHw() {
} }
void USBPhyHw::init(USBPhyEvents *events) { void USBPhyHw::init(USBPhyEvents *events) {
// Disable IRQ
//NVIC_DisableIRQ(USBD_IRQn);
this->events = events; this->events = events;
@ -101,8 +99,12 @@ void USBPhyHw::init(USBPhyEvents *events) {
*/ */
NRF_USBD->ISOINCONFIG |= 0x01; // set RESPONSE to 1 (respond with ZLP) NRF_USBD->ISOINCONFIG |= 0x01; // set RESPONSE to 1 (respond with ZLP)
// Enable IRQ // Set up the IRQ handler
NVIC_SetVector(USBD_IRQn, (uint32_t)USBD_HAL_IRQHandler); NVIC_SetVector(USBD_IRQn, (uint32_t)USBD_HAL_IRQHandler);
// Enable the power events
nrfx_power_usbevt_enable();
} }
void USBPhyHw::deinit() { void USBPhyHw::deinit() {
@ -544,17 +546,13 @@ void USBPhyHw::_reset(void)
void USBPhyHw::enable_usb_interrupts(void) { void USBPhyHw::enable_usb_interrupts(void) {
// Enable USB and USB-related power interrupts // Enable USB and USB-related power interrupts
NRFX_IRQ_ENABLE(USBD_IRQn); NRFX_IRQ_ENABLE(USBD_IRQn);
nrf_power_int_enable(NRF_POWER_INT_USBDETECTED_MASK | nrfx_power_usbevt_enable();
NRF_POWER_INT_USBREMOVED_MASK |
NRF_POWER_INT_USBPWRRDY_MASK);
} }
void USBPhyHw::disable_usb_interrupts(void) { void USBPhyHw::disable_usb_interrupts(void) {
// Disable USB and USB-related power interrupts // Disable USB and USB-related power interrupts
NRFX_IRQ_ENABLE(USBD_IRQn); NRFX_IRQ_DISABLE(USBD_IRQn);
nrf_power_int_disable(NRF_POWER_INT_USBDETECTED_MASK | nrfx_power_usbevt_disable();
NRF_POWER_INT_USBREMOVED_MASK |
NRF_POWER_INT_USBPWRRDY_MASK);
} }
static void power_usb_event_handler(nrfx_power_usb_evt_t event) { static void power_usb_event_handler(nrfx_power_usb_evt_t event) {