From 8123b5128ddce006b78e6f560aafe2ce75750b97 Mon Sep 17 00:00:00 2001 From: Naveen Kaje Date: Fri, 24 Aug 2018 14:53:05 -0500 Subject: [PATCH] serial_api: Fix the interrupt registration for Nordic Serial Device Using the nrfx_get_irq_number only works with the handle. Since we know the IRQ numbers for UART0, RTC2 and EGU0, use them directly. --- .../TARGET_NRF5x/TARGET_NRF52/serial_api.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/serial_api.c b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/serial_api.c index a6e36a3701..94a5cd1daa 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/serial_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/serial_api.c @@ -860,8 +860,8 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) NRF_RTC_INT_COMPARE1_MASK); /* Enable RTC2 IRQ. Priority is set to highest so that the UARTE ISR can't interrupt it. */ - NRFX_IRQ_PRIORITY_SET(nrfx_get_irq_number((void const*)RTC2_IRQn), APP_IRQ_PRIORITY_HIGHEST); - NRFX_IRQ_ENABLE(nrfx_get_irq_number((void const*)RTC2_IRQn)); + NRFX_IRQ_PRIORITY_SET(RTC2_IRQn, APP_IRQ_PRIORITY_HIGHEST); + NRFX_IRQ_ENABLE(RTC2_IRQn); /* Start RTC2. According to the datasheet the added power consumption is neglible so @@ -871,8 +871,8 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) /* Enable interrupts for SWI. */ NVIC_SetVector(SWI0_EGU0_IRQn, (uint32_t) nordic_nrf5_uart_swi0); - NRFX_IRQ_PRIORITY_SET(nrfx_get_irq_number((void const*)SWI0_EGU0_IRQn), APP_IRQ_PRIORITY_LOWEST); - NRFX_IRQ_ENABLE(nrfx_get_irq_number((void const*)SWI0_EGU0_IRQn)); + NRFX_IRQ_PRIORITY_SET(SWI0_EGU0_IRQn, APP_IRQ_PRIORITY_LOWEST); + NRFX_IRQ_ENABLE(SWI0_EGU0_IRQn); /* Initialize FIFO buffer for UARTE0. */ NRF_ATFIFO_INIT(nordic_nrf5_uart_fifo_0); @@ -892,8 +892,8 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) nrf_uarte_int_disable(nordic_nrf5_uart_register[0], 0xFFFFFFFF); NVIC_SetVector(UARTE0_UART0_IRQn, (uint32_t) nordic_nrf5_uart0_handler); - NRFX_IRQ_PRIORITY_SET(nrfx_get_irq_number((void const*)UARTE0_UART0_IRQn), APP_IRQ_PRIORITY_HIGHEST); - NRFX_IRQ_ENABLE(nrfx_get_irq_number((void const*)UARTE0_UART0_IRQn)); + NRFX_IRQ_PRIORITY_SET(UARTE0_UART0_IRQn, APP_IRQ_PRIORITY_HIGHEST); + NRFX_IRQ_ENABLE(UARTE0_UART0_IRQn); #if UART1_ENABLED /* Initialize FIFO buffer for UARTE1. */