外设宏定义USE_STDPERIPH_DRIVER
#if !defined USE_STDPERIPH_DRIVER
/**
* @brief Comment the line below if you will not use the peripherals drivers.
In this case, these drivers will not be included and the application code will
be based on direct access to peripherals registers
*/
/*#define USE_STDPERIPH_DRIVER*/
#endif
如果不适用片内外设,则不要取消 /*#define USE_STDPERIPH_DRIVER*/的注释
注意stm32f10x.h文件的最后有这样的代码:
#ifdef USE_STDPERIPH_DRIVER
#include "stm32f10x_conf.h"
#endif
stm32f10x_conf.h中包含了所有外设的头文件,因此任意源文件只要包含了stm32f10x.h,就可以在源文件调用任意外设的函数。
若有外设为使用到,在stm32f10x_conf.h注释相应部分,项目编译时就不会在编译去掉的外设。
问题解决了,我用的板子是stm32f103rbt6,按照原子哥的解决方案,是因为MDK4里面所包含的头文件问题,附链接如下:http://www.openedv.com/posts/list/10955.htm
附解释如下:http://blog.sina.com.cn/s/blog_0414b7360102v0o3.html
(链接侵删)
主要原因还是因为我用MDK4去学习MDK3的教程吧
希望对有相同问题的人有帮助,而且我这个是寄存器的例程,好像是和库函数的例程有那么一点区别(我猜的,我是小白,不对的请指教)
谢谢各位指导
评分
查看全部评分
#if !defined USE_STDPERIPH_DRIVER
/**
* @brief Comment the line below if you will not use the peripherals drivers.
In this case, these drivers will not be included and the application code will
be based on direct access to peripherals registers
*/
/*#define USE_STDPERIPH_DRIVER*/
#endif
如果不适用片内外设,则不要取消 /*#define USE_STDPERIPH_DRIVER*/的注释
注意stm32f10x.h文件的最后有这样的代码:
#ifdef USE_STDPERIPH_DRIVER
#include "stm32f10x_conf.h"
#endif
stm32f10x_conf.h中包含了所有外设的头文件,因此任意源文件只要包含了stm32f10x.h,就可以在源文件调用任意外设的函数。
若有外设为使用到,在stm32f10x_conf.h注释相应部分,项目编译时就不会在编译去掉的外设。
评分
查看全部评分
评分
查看全部评分
stm32f103R8
评分
查看全部评分
我尝试这样做过,这样就出现了invalid redeclaration的提示
我这样操作后,会继续提示缺少stm32f10x_type.h, stm32f10x_lib.h, stm32f10x_map.h, cortexm3_macro.h这些文件的提示,添加这些文件后就会出现invalid redeclaration的提示