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

Button event on NRF_GPIO_PIN_MAP(1, X)

I am using a nRF52840 PDK and trying to config 8 buttons.

(1) GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS to 8 (sdk_config.h)

(2) Add buttons define (pca10056.h)

Button event handler can trigger in P0.XX (e.g. XX is 3 or 4). But the event never trigger in P1.YY (e.g. 2 or 7)

Can I use P1.YY as a button??

#define BUTTON_7 NRF_GPIO_PIN_MAP(1,7)

Thanks.

Parents
  • Hi Alan,

    It seems like you found a bug. It is located in app_button.c in the function detection_delay_timeout_handler(). The function uses som uint32_t variables as pin masks. When you use port 1 the pins are numbered 32 and upwards. In certain places masks are created by left shifting 1 'pin number' amount of times. So you get sort of a rollover and the bit masks become 0. Anyway, I have attached a file called app_button.c with the necessary fixes and a file called diff.diff showing the changes I have made. The bug fix will be included in SDK 15. 

    Best regards

    Martin 

Reply
  • Hi Alan,

    It seems like you found a bug. It is located in app_button.c in the function detection_delay_timeout_handler(). The function uses som uint32_t variables as pin masks. When you use port 1 the pins are numbered 32 and upwards. In certain places masks are created by left shifting 1 'pin number' amount of times. So you get sort of a rollover and the bit masks become 0. Anyway, I have attached a file called app_button.c with the necessary fixes and a file called diff.diff showing the changes I have made. The bug fix will be included in SDK 15. 

    Best regards

    Martin 

Children
Related