野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12399|回复: 1

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

[复制链接]
发表于 2015-3-30 09:38:16 | 显示全部楼层 |阅读模式

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这个中断,该怎么做?       

回复

使用道具 举报

发表于 2015-3-30 17:54:40 来自手机 | 显示全部楼层
cmd使能失能,或者关时钟
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-9-28 21:27 , Processed in 0.029264 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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