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

A question of nrf_gpiote_unconfig(uint32_t channel_number) in nrf_gpiote.h

/**
 * @brief Function for unconfiguring GPIOTE channel.
 *
 *
 * Note that when unconfiguring the channel, the pin is configured as GPIO PIN_CNF configuration.
 *
 * @param channel_number specifies the GPIOTE channel [0:3] to unconfigure.
 */
static __INLINE void nrf_gpiote_unconfig(uint32_t channel_number)
{   
    /* Unonfigure the channel as the caller expects */
    NRF_GPIOTE->CONFIG[channel_number] = (GPIOTE_CONFIG_MODE_Disabled   << GPIOTE_CONFIG_MODE_Pos) |
                                         (31UL                          << GPIOTE_CONFIG_PSEL_Pos) |
                                         (GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos);
}

Why the PSEL is 31 , I want to disable the GPIOTE_CHANNEL[2], which I have enabled for GPIO_PIN 18 as external interrupt . I have never config the GPIO_PIN 31.

Parents
  • Since the mode is set to disabled, it doesn't really matter what PSEL is set to, as the next time it's configured it will have to be set again.

Reply
  • Since the mode is set to disabled, it doesn't really matter what PSEL is set to, as the next time it's configured it will have to be set again.

Children
No Data