DEFINE:STM32F10X_HD,USE_STDPERIPH_DRIVER的原因

库V3.5 main等源文件中不再直接包含stm32f10x_conf.h,而是stm32f10x.h,主程序第一句话就是#include“stm32f10x.h”。

而stm32f10x_conf.h被包含在了stm32f10x.h中,间接包含进了用户主程序文件。

stm32f10x.h则定义了启动设置,以及所有寄存器宏定义,此文件中需要注意的有:

设备(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
判断是否选择了设备(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)
#error "Please select first the target STM32F10x device used in your application (in stm32f10x.h file)"
#endif
 
未选择任何设备时,将会报错,所以在这之前的地“open for targe->C++”中需要预定义设备,我自己的是STM32F10X_HD。 
 
#if !defined  USE_STDPERIPH_DRIVER
 
#endif
 
#ifdef USE_STDPERIPH_DRIVER
#include "stm32f10x_conf.h"
#endif
 
所以也要对USE_STDPERIPH_DRIVER进行预定义,否则我们将无法使用库件库
永不止步步 发表于12-07 17:19 浏览65535次
分享到:

已有0条评论

暂时还没有回复哟,快来抢沙发吧

添加一条新评论

只有登录用户才能评论,请先登录注册哦!

话题作者

永不止步步
金币:67410个|学分:345327个
立即注册
畅学电子网,带你进入电子开发学习世界
专业电子工程技术学习交流社区,加入畅学一起充电加油吧!

x

畅学电子网订阅号