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

Joystick Interrupt

Are there any sample applications that use a joystick press as an interrupt instead of a button press? The dev board I'm using uses the nRF6350 display and I was wondering if there's any code around that I could refer to

Parents
  • Hi Håkon Alseth:

        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??
    
Reply
  • Hi Håkon Alseth:

        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??
    
Children
No Data
Related