学前班
最后登录1970-1-1
在线时间 小时
注册时间2015-5-25
|
编译主函数时候,EXTI_PA0_Config(); 这里会出现感叹号。不知道怎么情况。
外部中断 按教程PC13改成PA0 怎么提醒程序有误 。
实现PA0按键 LED翻转
主函数
- #include "stm32f10x.h"
- #include "bsp_led.h"
- #include "bsp_exti.h"
- #define CLI() __set_PRIMASK(1) /
- #define SEI() __set_PRIMASK(0) /
- /
- int main(void)
- {
- /* config the led */
- LED_GPIO_Config();
- LED1_ON;
-
- CLI(); //1Ø¿a ò»ÆeóÃ
- SEI();
-
- /* exti line config */
- EXTI_PA0_Config();
- /* wait interrupt */
- while(1)
- {
- }
- }
复制代码 bsp_exti.c
- #include "bsp_exti.h"
- static void NVIC_Configuration(void)
- {
- NVIC_InitTypeDef NVIC_InitStructure;
-
- /* Configure one bit for preemption priority */
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
-
- /* ÅäÖÃP[A|B|C|D|E]13ÎaÖD¶ÏÔ′ */
- NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
- NVIC_Init(&NVIC_InitStructure);
- }
- void EXTI_PA0_Config(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
- EXTI_InitTypeDef EXTI_InitStructure;
- /* config the extiline(PC13) clock and AFIO clock */
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO,ENABLE);
-
- /* config the NVIC(PC13) */
- NVIC_Configuration();
- /* EXTI line gpio config(PC13) */
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; // éÏà-êäèë
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- /* EXTI line(PC13) mode config */
- GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource0);
- EXTI_InitStructure.EXTI_Line = EXTI_Line0;
- EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
- EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
- EXTI_InitStructure.EXTI_LineCmd = ENABLE;
- EXTI_Init(&EXTI_InitStructure);
- }
- /*********************************************END OF FILE**********************/
复制代码
bsp_exti.h
- #ifndef __EXTI_H
- #define __EXTI_H
- #include "stm32f10x.h"
- void EXTI_PA0_Config(void);
- #endif /* __EXTI_H */
复制代码
|
-
这里出现一个感叹号。
-
这里有问题描述。
|