打印

如何在需要时开启外部中断,不需要时关闭中断?

[复制链接]
223|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
冷冻链|  楼主 | 2019-11-28 08:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
EXTI_InitTypeDef   EXTI_InitStructure;
GPIO_InitTypeDef   GPIO_InitStructure;
                /* config the extiline clock  */
          RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD,ENABLE);
                /* EXTI line gpio config*/        
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;      
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;         // 上拉输入
  GPIO_Init(GPIOD, &GPIO_InitStructure);
                /* EXTI line mode config */
  GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource6);
  EXTI_InitStructure.EXTI_Line = EXTI_Line6;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; //下降沿中断
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);
如果要在其他地方需要失能PD6这个中断,该怎么做?

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

397

主题

397

帖子

0

粉丝