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

NRF Button Handler not working on nRF52 PORT1 GPIOs

Hello,

I would like to use the button handler library (app_button) from the nRF SDK on my nRF52840 to detect pushes on pin P1.05. However, no events are detected when the button is pushed.

Looking further into the library, I found that in app_button.c@gpiote_event_handler and @detection_delay_timeout_handler, a bit-shift is used to make a pin mask. For example at app_button.c:99:

uint32_t pin_mask = 1 << pin;

However, the value of "pin" in this case is 37. Since pin_mask is of type uint32_t, it is unable to hold 1<<37 resulting in a value of 0. This was checked with a debugger as shown in the image below:

image description

Am I missing something or is this a bug in the SDK?

Related