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

DEFINE:STM32F10X_HD,USE_STDPERIPH_DRIVER的原因

作者:佚名   來(lái)源:本站原創(chuàng)   點(diǎn)擊數(shù):  更新時(shí)間:2014年08月19日   【字體:

庫(kù)V3.5 main等源文件中不再直接包含stm32f10x_conf.h,而是stm32f10x.h,主程序第一句話就是#include“stm32f10x.h”。而stm32f10x_conf.h被包含在了stm32f10x.h中,間接包含進(jìn)了用戶主程序文件。stm32f10x.h則定義了啟動(dòng)設(shè)置,以及所有寄存器宏定義,此文件中需要注意的有:

設(shè)備(device)

#if !defined (STM32F10X_LD) && !defined (STM32F10X_LD_VL) && !defined (STM32F10X_MD) && !defined (STM32F10X_MD_VL) && !defined (STM32F10X_HD) && !defined (STM32F10X_HD_VL) && !defined (STM32F10X_XL) && !defined (STM32F10X_CL) 
     
     
     
     
     
     
     
     
#endif
判斷是否選擇了設(shè)備(device),取消下面任何一個(gè)注釋,可以進(jìn)行默認(rèn)設(shè)備
 
 
#if !defined (STM32F10X_LD) && !defined (STM32F10X_LD_VL) && !defined (STM32F10X_MD) && !defined (STM32F10X_MD_VL) && !defined (STM32F10X_HD) && !defined (STM32F10X_HD_VL) && !defined (STM32F10X_XL) && !defined (STM32F10X_CL)
 #error "Please select first the target STM32F10x device used in your application (in stm32f10x.h file)"
#endif
未選擇任何設(shè)備時(shí),將會(huì)報(bào)錯(cuò),所以在這之前的地“open for targe->C++”中需要預(yù)定義設(shè)備,我自己的是STM32F10X_HD。
 
 
#if !defined  USE_STDPERIPH_DRIVER
 
#endif

#ifdef USE_STDPERIPH_DRIVER
  #include "stm32f10x_conf.h"
#endif
 
所以也要對(duì)USE_STDPERIPH_DRIVER進(jìn)行預(yù)定義,否則我們將無(wú)法使用庫(kù)件庫(kù)
關(guān)閉窗口

相關(guān)文章