專注電子技術(shù)學(xué)習(xí)與研究
當(dāng)前位置:單片機教程網(wǎng) >> STM32 >> 瀏覽文章

error: #20: identifier GPIO_LED is undefined

作者:電影種子   來源:電影種子   點擊數(shù):  更新時間:2014年06月17日   【字體:

昨天學(xué)習(xí)STM32的UART串口部分的代碼,因為之前學(xué)習(xí)系統(tǒng)定時器,所以想綜合一下這兩個程序,沒想到遇到如下問題:

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

感覺很郁悶,因為我已經(jīng)在"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
關(guān)閉窗口

相關(guān)文章