Discuz! Board
标题:
求助,请问INTENSET一个被重复赋值了四次,这样IN0-2不是被覆盖了吗,为何还能用?
[打印本页]
作者:
XJing
时间:
2022-6-22 15:58
标题:
求助,请问INTENSET一个被重复赋值了四次,这样IN0-2不是被覆盖了吗,为何还能用?
void gpiote_init(void)
{
nrf_gpio_cfg_input(PCA10040_BUTTON1, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_input(PCA10040_BUTTON2, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_input(PCA10040_BUTTON3, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_input(PCA10040_BUTTON4, NRF_GPIO_PIN_PULLUP);
NVIC_EnableIRQ(GPIOTE_IRQn); /* Enable Interrupt */
NRF_GPIOTE->CONFIG[0] = (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos) | (PCA10040_BUTTON1 << GPIOTE_CONFIG_PSEL_Pos) |(GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos);
NRF_GPIOTE->CONFIG[1] = (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos) | (PCA10040_BUTTON2 << GPIOTE_CONFIG_PSEL_Pos) |(GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos);
NRF_GPIOTE->CONFIG[2] = (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos) | (PCA10040_BUTTON3 << GPIOTE_CONFIG_PSEL_Pos) |(GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos);
NRF_GPIOTE->CONFIG[3] = (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos) | (PCA10040_BUTTON4 << GPIOTE_CONFIG_PSEL_Pos) |(GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos);
NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_IN0_Set << GPIOTE_INTENSET_IN0_Pos;
NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_IN1_Set << GPIOTE_INTENSET_IN1_Pos;
NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_IN2_Set << GPIOTE_INTENSET_IN2_Pos;
NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_IN3_Set << GPIOTE_INTENSET_IN3_Pos;
}
作者:
XJing
时间:
2023-1-12 21:56
本帖最后由 XJing 于 2023-1-12 21:58 编辑
鉴于这么久没人理我,我自己回复一下初学时的低级问题,这个寄存器只管开门不管关门,置零没啥用,请和INTENCLR搭配使用。
欢迎光临 Discuz! Board (http://qfv8.com/)
Powered by Discuz! X3