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

nrf51822 External interrupt

Hi

I use the PORT EVENT to produce multiple interrupts.But I have a question by these: 

NRF_GPIO->PIN_CNF[BUTTON1] = (GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos) | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) | (NRF_GPIO_PIN_NOPULL << GPIO_PIN_CNF_PULL_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);

NRF_GPIO->PIN_CNF[BUTTON2] = (GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos) | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) | (NRF_GPIO_PIN_NOPULL << GPIO_PIN_CNF_PULL_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);

void GPIOTE_IRQHandler(void) {
if ((NRF_GPIOTE->EVENTS_PORT != 0)) { NRF_GPIOTE->EVENTS_PORT = 0; } . if (nrf_gpio_pin_read(BUTTON1) == 0) { //do something }

if (nrf_gpio_pin_read(BUTTON2) == 0) { //do something }

}

I found that when the BOTTON1 is pressed, now I press BOTTON2, it couldn't product a interrupt.At the same time can't have two keys in pressed state.How I could solve it??

Parents Reply Children
No Data
Related