假如你运用stm32f10x_stdperiph_lib,会发现在stm32f10x.h文件会有一段关于宏挑选的代码,如:
[cpp]view plaincopy
- #if!defined(STM32F10X_LD)&&!defined(STM32F10X_MD)&&!defined(STM32F10X_HD)&&!defined(STM32F10X_CL)
- /*#defineSTM32F10X_LD*//*!
- /*#defineSTM32F10X_MD*//*!
- /*#defineSTM32F10X_HD*//*!
- #defineSTM32F10X_CL/*!
- #endif
- /*#defineSTM32F10X_MD*//*!
至于要运用哪个宏,则需要依据详细的芯片来进行挑选。那么,这些宏又对应着哪些详细的芯片呢?其实咱们能够在《Reference manual》的第九章中找到答案,如文档截图:
这段话的意思很明显,假如是STM32F105xx和STM32F107xx,是Connectivity Line Devices,则宏界说挑选的是STM32F10X_CL;假如是其他类型,则依据FLASH的容量来进行挑选。或许文字写的有点不太清楚,还是以表格来阐明:
宏 |
MCU类型 |
FLASH巨细 |
STM32F10X_LD |
STM32F101xx STM32F102xx STM32F103xx |
16 ~ 32 Kbytes |
STM32F10X_MD |
STM32F101xx STM32F102xx STM32F103xx |
64 ~ 128 Kbytes |
STM32F10X_HD |
STM32F101xx STM32F103xx |
256 ~ 512 Kbytes |
STM32F10X_CL |
STM32F105xx STM32F107xx |
疏忽 |
这些参数,和MDK的设备参数共同,如图所示: