专注电子技术学习与研究
当前位置:单片机教程网 >> STM32 >> 浏览文章

error: #20: identifier GPIO_LED is undefined

作者:电影种子   来源:电影种子   点击数:  更新时间:2014年06月17日   【字体:

昨天学习STM32的UART串口部分的代码,因为之前学习系统定时器,所以想综合一下这两个程序,没想到遇到如下问题:

Source\main.c(49): error:  #20: identifier "GPIO_LED" is undefined

感觉很郁闷,因为我已经在"platform_config.h"中定义了
 
#ifdef USE_STM3210B_EVAL
  #define GPIO_LED                   GPIOC    
  #define RCC_APB2Periph_GPIO_LED    RCC_APB2Periph_GPIOC
#elif defined USE_STM3210E_EVAL
  #define GPIO_LED                   GPIOF    
  #define RCC_APB2Periph_GPIO_LED    RCC_APB2Periph_GPIOF
#endif

总之查找了一天都没有找到原因,所以昨天我的整个人都感觉不好,今天早上在度娘里偶然看到了一篇文章,于是瞬间拨开乌云。
 
问题原因:stm32f10x_conf.h中将GPIOF给屏蔽掉了。
 
 
#define _GPIO
#define _GPIOA
#define _GPIOB
#define _GPIOC
#define _GPIOD
#define _GPIOE
//#define _GPIOF
#define _GPIOG
#define _AFIO

将以上代码修改,祛除屏蔽,然后你的整个人都爽了

#define _GPIO
#define _GPIOA
#define _GPIOB
#define _GPIOC
#define _GPIOD
#define _GPIOE
#define _GPIOF
#define _GPIOG
#define _AFIO
关闭窗口

相关文章