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

nRF51822 - Small error in nrf6310 pin_change_int_example

in gpio_init():

NRF_GPIOTE->CONFIG[0] =  (GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos)
                       | (0 << GPIOTE_CONFIG_PSEL_Pos)  
                       | (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos);

the 0 should be changed to BUTTON_0 like this:

NRF_GPIOTE->CONFIG[0] =  (GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos)
                       | (BUTTON_0 << GPIOTE_CONFIG_PSEL_Pos)  
                       | (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos);

Well for the nRF6310 it doesn't matter, but it's a bit confusing if someone try to port this tiny example to a different board.

(Found in Sdk 5.2.0)

Related