This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Interrupt handler

Hi,

I use the nRF52840 DK with Segger IDE.

I would like to use different peripherals on the MCU (GPIO, SPI, Timers etc), but I would like to avoid using the Nordic SDK, because I find the documentation quite confusing and lacks descriptions.

I would like to just address the different registers directly - which is working ok. I can't however find any documentation on how to declare interrupts for different events. Does anybody knows how to declare a callback function that gets triggered every time a GPIO changes?

Hope someone can help.

Parents Reply Children
  • Hi,

    Take a look at the example under "examples\peripheral\rtc". You will need to declare a void function for "RTC0_IRQHandler", see the declarations of irq_handler and nrfx_rtc_0_irq_handler in nrfx_rtc.c, and the define in line 104 in nrfx_irqs_nrf52840.h

    // TIMER0_IRQn
    #define nrfx_timer_0_irq_handler    TIMER0_IRQHandler

    #if NRFX_CHECK(NRFX_RTC0_ENABLED)
    void nrfx_rtc_0_irq_handler(void)
    {
        irq_handler(NRF_RTC0, NRFX_RTC0_INST_IDX, NRF_RTC_CC_CHANNEL_COUNT(0));
    }
    #endif

    You can also take a look at this snippet here.

Related