当前位置:网站首页>STM32F030外部中断配置
STM32F030外部中断配置
2022-07-15 19:45:00 【小老虎_IOT】
1、说明
STM32F030芯片,PC13为外部中断触发,下降沿的配置;
注意开启SYSCFG时钟;
void back_key_init(void)
{
EXTI_InitTypeDef EXTI_InitStructure; //EXTIx中断线配置
NVIC_InitTypeDef NVIC_InitStructure; //EXTIx中断向量配置
pin_input_init(BACK_KEY); //浮空输入,原理图已上拉
//配置按键引脚为下降沿中断
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG,ENABLE);
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOC,EXTI_PinSource13); //将EXTI13指向PC13
EXTI_InitStructure.EXTI_Line=EXTI_Line13;
EXTI_InitStructure.EXTI_Mode=EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger=EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd=ENABLE;
EXTI_Init(&EXTI_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel=EXTI4_15_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPriority=0x01;
NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void EXTI4_15_IRQHandler(void){
if(EXTI_GetITStatus(EXTI_Line13)!=RESET){ //判断是EXTI_Line13
}
EXTI_ClearFlag(EXTI_Line13); //退出中断时清除标志位
}边栏推荐
猜你喜欢

Codeforces Round #804 C The Third Problem

【开源可信隐私计算框架 “隐语”】蚂蚁宣布面向全球开发者正式开源

Educational Codeforces Round 131 A - D

Codeforces Round #802 B. Palindromic Numbers

腾势全新豪华中大型MPV曝光,安全、舒适一个不落

脚本编写规则和变量定义

Can SQL also play AI? you 're right! Mlops meetup V3 review openmlbd+sqlflow+byzer

Codeforces Global Round 21 D. Permutation Graph

Leetcode-83- delete duplicate elements in the linked list

Codeforces Round #804 A The Third Three Number Problem
随机推荐
迪赛智慧数——折(渐变堆叠图):全国居民人均可支配收入
Codeforces Global Round 21 C. Fishingprince Plays With Array
Hcip day 8 notes
Help, update to Siyuan v2.0.27, dark+ theme adaptive width problem
设计稳定的微服务系统时不得不考虑的场景
Codeforces Round #802 B. Palindromic Numbers
7-Redis架构设计到使用场景-缓存穿透、缓存雪崩、缓存预热、缓存降级
Nest 框架
In a real case, college students were cheated when taking orders. I hope you won't be cheated [painful lesson]
[open source trusted privacy computing framework "argot"] ant announced the official open source for global developers
Codeforces Round #805 A - G
C writes the database connection mode to the configuration file
Win11系统.NET Framework 3.5怎么启用?
6-Redis架构设计到使用场景-持久化机制、缓存失效策略、缓存命中率
Codeforces Round #802 B. Palindromic Numbers
【快速下载VsCode】
How to deploy polardb for PostgreSQL?
CUDA和cuDNN安装教程(超详细).卸载CUDA、安装CUDA的nsight visual studio edition失败的情况、VS2019+CUDA11.1新建项目里没有CUDA选项
VS2019+CUDA11.1新建项目里没有CUDA选项
【ARCGIS创建中国南海诸岛及九段线小图框】