设为首页收藏本站

Discuz! Board

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 18|回复: 0

求助,请问INTENSET一个被重复赋值了四次,这样IN0-2不是被覆盖了吗,为何还能用?

[复制链接]

1

主题

1

帖子

19

积分

新手上路

Rank: 1

积分
19
XJing 发表于 5 天前 | 显示全部楼层 |阅读模式
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;

}
回复

使用道具 举报

Archiver|手机版|小黑屋|Comsenz Inc.   

GMT+8, 2022-6-27 16:22 , Processed in 0.113037 second(s), 30 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表