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

button_event_handler and matrix

I am using a simple 4 by 4 matrixed keypad, and I would like to handle some of the decoding myself. In essence, I would like to configure all 4 rows as low driven output pins and have the sd handle the 4 column inputs as though they were single buttons. Then, in the button event handler, I'd like to change the configuration of the rows to inputs with pull-ups, drive the columns low, and read the row inputs. After doing the decoding, I'll restore the original configuartion, i.e columns input with pull-ups, rows driven low. So nothing clever, just one of the standard ways of reading a simple matrix. My question is will this work, or will I need to disable the button_handler for the duration of the event handler by some means?

The alternative would be for me to configure a timer event and do the scanning manually, but I'm not sure which method would result in the lower power consumption.

Parents
  • @JohnBrown: if you add your code inside GPIOTE_IRQ, think you should be fine. Make sure you don't clear the GPIO PORT event before you start your scanning. Then you can disable sense, modify the configuration to do the scanning. Then switch back to the original configuration, clear GPIO_PORT event, and continue to flip the SENSE signal for the signal which triggered the interrupt as we normally do with app_gpiote.

Reply
  • @JohnBrown: if you add your code inside GPIOTE_IRQ, think you should be fine. Make sure you don't clear the GPIO PORT event before you start your scanning. Then you can disable sense, modify the configuration to do the scanning. Then switch back to the original configuration, clear GPIO_PORT event, and continue to flip the SENSE signal for the signal which triggered the interrupt as we normally do with app_gpiote.

Children
Related