Hi everyone,
I'm learning about proggram the nRF52840 dongle and I tried to code an interruption. Press the SW2 to turn on a LED
#include "boards.h" #include "nrf_delay.h" #include <stdbool.h> #include <stdint.h> #define MODE 0 #define PSEL 8 #define PORT 13 #define POLARITY 16 #define OUTINIT 20 int main(void) { //PIN SETTINGS //Boton NRF_P1->PIN_CNF[6] = (0x00 << 0x00) | (0x01 << 0x02) | (0x00 << 0x08) | (0x02 << 0x16); //LED NRF_P0->PIN_CNF[8] = (0x01 << 0x00); //BOTON config NRF_GPIOTE->CONFIG[0] = (0x01 << MODE) | (0x02 << PSEL) | (0x00 << PORT) | (0x01 << POLARITY); //LED config NRF_GPIOTE->CONFIG[1] = (0x03 << MODE) | (0x08 << PSEL) | (0x00 << PORT) | (0x00 << POLARITY) | (0x01 << OUTINIT); //Enable Tasks & Events NRF_GPIOTE->INTENSET = (0x01 << 0x00) | (0x01 << 0x01); //RESET EVENTS NRF_GPIOTE->EVENTS_IN[0] = 0; NRF_P0->OUT = (0x01 << 0x08); //CODE while (true) { if (NRF_GPIOTE->EVENTS_IN[0] != 0) { NRF_GPIOTE->TASKS_SET[1]; } else { NRF_GPIOTE->TASKS_CLR[1]; } } }
So, looking at this code, where did I fail?
Thanks for helping and best regards.