stm32f10x(1)

img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上物联网嵌入式知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、电子书籍、讲解视频,并且后续会持续更新

需要这些体系化资料的朋友,可以加我V获取:vip1024c (备注嵌入式)

如果你需要这些资料,可以戳这里获取

go on:

用于定义是否使用外设驱动,如果注释掉或者keil中没设全局宏定义的话,则代表不使用ST库提供的外设驱动库,在本文倒数第二段代码中有句

#ifdef USE_STDPERIPH_DRIVER

#include “stm32f10x_conf.h”

#endif

stm32f10x_conf.h用于外设注释配置。

复制代码

#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

复制代码

下面应该是对于器件HSE的设置

复制代码

/\*\*
 \* @brief In the following line adjust the value of External High Speed oscillator (HSE)
 used in your application 
 
 Tip: To avoid modifying this file each time you need to use different HSE, you
 can define the HSE value in your toolchain compiler preprocessor.
 \*/           
#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 */

复制代码

设置启动超时值和HSI

复制代码

/\*\*
 \* @brief In the following line adjust the External High Speed oscillator (HSE) Startup 
 Timeout value 
 \*/
#define HSE_STARTUP_TIMEOUT   ((uint16_t)0x0500) /*!< Time out for HSE start up */

#define HSI_VALUE    ((uint32_t)8000000) /*!< Value of the Internal oscillator in Hz*/

复制代码

标准外设库版本号的定义

复制代码

/\*\*
 \* @brief STM32F10x Standard Peripheral Library version number
 \*/
#define __STM32F10X_STDPERIPH_VERSION_MAIN   (0x03) /*!< [31:24] main version */                                  
#define __STM32F10X_STDPERIPH_VERSION_SUB1   (0x05) /*!< [23:16] sub1 version */
#define __STM32F10X_STDPERIPH_VERSION_SUB2   (0x00) /*!< [15:8]  sub2 version */
#define __STM32F10X_STDPERIPH_VERSION_RC     (0x00) /*!< [7:0]  release candidate */ 
#define __STM32F10X_STDPERIPH_VERSION       ( (__STM32F10X_STDPERIPH_VERSION_MAIN << 24)\
                                             |(__STM32F10X_STDPERIPH_VERSION_SUB1 << 16)\
 |(__STM32F10X_STDPERIPH_VERSION_SUB2 << 8)\
 |(__STM32F10X_STDPERIPH_VERSION_RC))

复制代码

配置Cortex-M3处理器和核内外设

复制代码

/\*\*
 \* @brief Configuration of the Cortex-M3 Processor and Core Peripherals 
 \*/
#ifdef STM32F10X\_XL
 #define __MPU_PRESENT             1 /*!< STM32 XL-density devices provide an MPU */
#else
 #define __MPU_PRESENT             0 /*!< Other STM32 devices does not provide an MPU */
#endif /* STM32F10X_XL */
#define __NVIC_PRIO_BITS          4 /*!< STM32 uses 4 Bits for the Priority Levels    */
#define __Vendor_SysTickConfig    0 /*!< Set to 1 if different SysTick Config is used */

复制代码

中断线定义,前部分对于所有STM32F10x都有相同定义,后部分根据不同器件容量采用条件编译定义不同中断线。

复制代码

/\*\*
 \* @brief STM32F10x Interrupt Number Definition, according to the selected device 
 \* in @ref Library\_configuration\_section 
 \*/
typedef enum IRQn
{
/\*\*\*\*\*\* Cortex-M3 Processor Exceptions Numbers \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/
 NonMaskableInt\_IRQn = -14,    /\*!< 2 Non Maskable Interrupt \*/
 MemoryManagement\_IRQn = -12,    /\*!< 4 Cortex-M3 Memory Management Interrupt \*/
 BusFault\_IRQn = -11,    /\*!< 5 Cortex-M3 Bus Fault Interrupt \*/
 UsageFault\_IRQn = -10,    /\*!< 6 Cortex-M3 Usage Fault Interrupt \*/
 SVCall\_IRQn = -5,     /\*!< 11 Cortex-M3 SV Call Interrupt \*/
 DebugMonitor\_IRQn = -4,     /\*!< 12 Cortex-M3 Debug Monitor Interrupt \*/
 PendSV\_IRQn = -2,     /\*!< 14 Cortex-M3 Pend SV Interrupt \*/
 SysTick\_IRQn = -1,     /\*!< 15 Cortex-M3 System Tick Interrupt \*/

/\*\*\*\*\*\* STM32 specific Interrupt Numbers \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/
 WWDG\_IRQn = 0,      /\*!< Window WatchDog Interrupt \*/
 PVD\_IRQn = 1,      /\*!< PVD through EXTI Line detection Interrupt \*/
 TAMPER\_IRQn = 2,      /\*!< Tamper Interrupt \*/
 RTC\_IRQn = 3,      /\*!< RTC global Interrupt \*/
 FLASH\_IRQn = 4,      /\*!< FLASH global Interrupt \*/
 RCC\_IRQn = 5,      /\*!< RCC global Interrupt \*/
 EXTI0\_IRQn = 6,      /\*!< EXTI Line0 Interrupt \*/
 EXTI1\_IRQn = 7,      /\*!< EXTI Line1 Interrupt \*/
 EXTI2\_IRQn = 8,      /\*!< EXTI Line2 Interrupt \*/
 EXTI3\_IRQn = 9,      /\*!< EXTI Line3 Interrupt \*/
 EXTI4\_IRQn = 10,     /\*!< EXTI Line4 Interrupt \*/
 DMA1\_Channel1\_IRQn = 11,     /\*!< DMA1 Channel 1 global Interrupt \*/
 DMA1\_Channel2\_IRQn = 12,     /\*!< DMA1 Channel 2 global Interrupt \*/
 DMA1\_Channel3\_IRQn = 13,     /\*!< DMA1 Channel 3 global Interrupt \*/
 DMA1\_Channel4\_IRQn = 14,     /\*!< DMA1 Channel 4 global Interrupt \*/
 DMA1\_Channel5\_IRQn = 15,     /\*!< DMA1 Channel 5 global Interrupt \*/
 DMA1\_Channel6\_IRQn = 16,     /\*!< DMA1 Channel 6 global Interrupt \*/
 DMA1\_Channel7\_IRQn = 17,     /\*!< DMA1 Channel 7 global Interrupt \*/

 #ifdef STM32F10X\_LD
 ...
 #endif /* STM32F10X_LD */  

 #ifdef STM32F10X\_LD\_VL
 ...
 #endif /* STM32F10X_LD_VL */

 #ifdef STM32F10X\_MD
 ...
 #endif /* STM32F10X_MD */  

 #ifdef STM32F10X\_MD\_VL
 ...
 #endif /* STM32F10X_MD_VL */

 #ifdef STM32F10X\_HD
 ...
 #endif /* STM32F10X_HD */  

 ...
 ...
 ...
} IRQn\_Type;

复制代码

为兼容旧版本类似而生。

复制代码

@addtogroup Exported\_types  
/\*!< STM32F10x Standard Peripheral Library old types (maintained for legacy purpose) \*/
typedef int32\_t s32;
typedef int16\_t s16;
typedef int8\_t s8;

typedef const int32_t sc32;  /\*!< Read Only \*/
typedef const int16_t sc16;  /\*!< Read Only \*/
typedef const int8_t sc8;   /\*!< Read Only \*/

typedef \_\_IO int32\_t vs32;
typedef \_\_IO int16\_t vs16;
typedef \_\_IO int8\_t vs8;

typedef \_\_I int32\_t vsc32; /\*!< Read Only \*/
typedef \_\_I int16\_t vsc16; /\*!< Read Only \*/
typedef \_\_I int8\_t vsc8; /\*!< Read Only \*/

typedef uint32\_t u32;
typedef uint16\_t u16;
typedef uint8\_t u8;

typedef const uint32_t uc32;  /\*!< Read Only \*/
typedef const uint16_t uc16;  /\*!< Read Only \*/
typedef const uint8_t uc8;   /\*!< Read Only \*/

typedef \_\_IO uint32\_t vu32;
typedef \_\_IO uint16\_t vu16;
typedef \_\_IO uint8\_t vu8;

typedef \_\_I uint32\_t vuc32; /\*!< Read Only \*/
typedef \_\_I uint16\_t vuc16; /\*!< Read Only \*/
typedef \_\_I uint8\_t vuc8; /\*!< Read Only \*/

typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus;

typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))

typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;  

/\*!< STM32F10x Standard Peripheral Library old definitions (maintained for legacy purpose) \*/
#define HSEStartUp_TimeOut   HSE_STARTUP_TIMEOUT
#define HSE_Value            HSE_VALUE
#define HSI_Value            HSI_VALUE

复制代码

把全部外设寄存器定义成结构体

复制代码

/\* @addtogroup Peripheral\_registers\_structures \*/  

/\*\* 
 \* @brief Analog to Digital Converter 
 \*/
typedef struct
{
} ADC\_TypeDef;

/\*\* 
 \* @brief Backup Registers 
 \*/
typedef struct
{
} BKP\_TypeDef;

/\*\* 
 \* @brief Controller Area Network TxMailBox 
 \*/
typedef struct
{
} CAN\_TxMailBox\_TypeDef;

/\*\* 
 \* @brief Controller Area Network FIFOMailBox 
 \*/
typedef struct
{
} CAN\_FIFOMailBox\_TypeDef;

/\*\* 
 \* @brief Controller Area Network FilterRegister 
 \*/
typedef struct
{
} CAN\_FilterRegister\_TypeDef;

/\*\* 
 \* @brief Controller Area Network 
 \*/
typedef struct
{
} CAN\_TypeDef;

/\*\* 
 \* @brief Consumer Electronics Control (CEC)
 \*/
typedef struct
{
} CEC\_TypeDef;

/\*\* 
 \* @brief CRC calculation unit 
 \*/
typedef struct
{
} CRC\_TypeDef;

/\*\* 
 \* @brief Digital to Analog Converter
 \*/
typedef struct
{
} DAC\_TypeDef;

/\*\* 
 \* @brief Debug MCU
 \*/
typedef struct
{
}DBGMCU\_TypeDef;

/\*\* 
 \* @brief DMA Controller
 \*/
typedef struct
{
} DMA\_Channel\_TypeDef;
typedef struct
{
} DMA\_TypeDef;

/\*\* 
 \* @brief Ethernet MAC
 \*/
typedef struct
{
} ETH\_TypeDef;

/\*\* 
 \* @brief External Interrupt/Event Controller
 \*/
typedef struct
{
} EXTI\_TypeDef;

/\*\* 
 \* @brief FLASH Registers
 \*/
typedef struct
{
} FLASH\_TypeDef;

/\*\* 
 \* @brief Option Bytes Registers
 \*/
typedef struct
{
} OB\_TypeDef;

/\*\* 
 \* @brief Flexible Static Memory Controller
 \*/
typedef struct
{
} FSMC\_Bank1\_TypeDef; 

/\*\* 
 \* @brief Flexible Static Memory Controller Bank1E
 \*/
typedef struct
{
} FSMC\_Bank1E\_TypeDef;

/\*\* 
 \* @brief Flexible Static Memory Controller Bank2
 \*/


**收集整理了一份《2024年最新物联网嵌入式全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升的朋友。**
![img](https://img-blog.csdnimg.cn/img_convert/360ab8a36840d6591cbb23dbccbdc6fb.png)
![img](https://img-blog.csdnimg.cn/img_convert/c640195d65c1ba1e9ceb62da8ce4f1ce.png)

**[如果你需要这些资料,可以戳这里获取](https://bbs.csdn.net/topics/618679757)**

**需要这些体系化资料的朋友,可以加我V获取:vip1024c (备注嵌入式)**

**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人**

**都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

/\*\* 
 \* @brief Flexible Static Memory Controller Bank2
 \*/


**收集整理了一份《2024年最新物联网嵌入式全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升的朋友。**
[外链图片转存中...(img-bC9SsF9Y-1715909113712)]
[外链图片转存中...(img-uYSHS3z8-1715909113712)]

**[如果你需要这些资料,可以戳这里获取](https://bbs.csdn.net/topics/618679757)**

**需要这些体系化资料的朋友,可以加我V获取:vip1024c (备注嵌入式)**

**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人**

**都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值