zoukankan
html css js c++ java
stm32f10x_conf.h 与 stm32f10x.h(转载)
摘自:
http://blog.chinaunix.net/uid-24671805-id-3168404.html
新版的固件库V3.0以上 main等源文件中不再直接包含stm32f10x_conf.h,而是stm32f10x.h,stm32f10x.h则定义了启动设置,以及所有寄存器宏定义,此文件中需要注意的有:
1、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)
/* #define STM32F10X_LD */ /*!< STM32F10X_LD: STM32 Low density devices */
/* #define STM32F10X_LD_VL */ /*!< STM32F10X_LD_VL: STM32 Low density Value Line devices */
/* #define STM32F10X_MD */ /*!< STM32F10X_MD: STM32 Medium density devices */
#define STM32F10X_MD
/* #define STM32F10X_MD_VL */ /*!< STM32F10X_MD_VL: STM32 Medium density Value Line devices */
/* #define STM32F10X_HD */ /*!< STM32F10X_HD: STM32 High density devices */
/* #define STM32F10X_HD_VL */ /*!< STM32F10X_HD_VL: STM32 High density value line devices */
/* #define STM32F10X_XL */ /*!< STM32F10X_XL: STM32 XL-density devices */
/* #define STM32F10X_CL */ /*!< STM32F10X_CL: STM32 Connectivity line devices */
#endif
此段代码在stm32f10x.h的开始处,根据所用的器件 取消合适的注释。我常用的是stm32f103c8t6 属于Medium density Value Line devices.
2、外部时钟频率选择
#if !defined HSE_VALUE
#ifdef STM32F10X_CL
#define HSE_VALUE ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */
#else
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
#endif /* STM32F10X_CL */
#endif /* HSE_VALUE */
注意STM32F10X_CL,STM32F10X_CL是stm32f105 和stm32f107 互联型的device,用到此器件外部要选用25MHz的晶体,由于前面的代码没有取消 /* #define STM32F10X_CL */ /*!< STM32F10X_CL: STM32 Connectivity line devices */的注释,所以此处默认的外部8MHz的晶体
3、外设宏定义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注释相应部分,项目编译时就不会在编译去掉的外设。
转载:http://hi.baidu.com/ancient2008/blog/item/ea0ea30d4aa59cd53bc7638c.html
查看全文
相关阅读:
Android SDK、NDK、JNI的简单介绍
深入理解计算机系统—异常
Jmeter3.1 使用及新增报告功能
jmeter3.1连接数据库报错,ORA00923: 未找到要求的 FROM 关键字
Jenkins插件、war下载地址
jenkins自动打tag
jenkins参数化构建过程
Jmeter接口测试自动化(jmeter+ant+jenkins持续集成)
既然选择开始就不会停下
知识提升整体
原文地址:https://www.cnblogs.com/CodeWorkerLiMing/p/12007571.html
最新文章
ComponentOne 2012V3 .NET主流平台正式支持中文本地化
ComponentOne FlexGrid for WinForms 中文版快速入门(7)—概述和汇总数据(上)
ComponentOne FlexGrid for WinForms 中文版快速入门(1)开始使用 FlexGrid
ComponentOne FlexGrid for WinForms 中文版快速入门(7)—概述和汇总数据(下)
ComponentOne FlexGrid for WinForms 中文版快速入门(5)设置单元格类型(上)
ComponentOne FlexGrid for WinForms 中文版快速入门(4)设置单元格格式
通过JSP调用Servlet
JavaBean的三个条件
九大内置对象的方法笔记
Servlet学习
热门文章
JSP内置动作笔记
JSP Overall 笔记
Servlet简单例子
Transient, volatile, strictfp
JSP指令细节笔记
人生的尺度效应
Java类加载器(死磕 12)
深入理解计算机系统—链接
设备管理之命令行工具 devcon.exe(转)
Android 4.0.1 源码下载,编译和运行
Copyright © 2011-2022 走看看