>
IAR编译器中STM32F10X_XX宏定义的选择其中
USE_STDPERIPH_DRIVER和STM32F10X_HD什么意思?(1)USE_STDPERIPH_DRIVER to use or not the peripheral’s drivers in application code (i.e. code will be based on direct access to peripheral’s registers rather than drivers API) , this option is controlled by the #define USE_STDPERIPH_DRIVER即这个定义控制了是否在应用中启用外设驱动。我们使用标准外设库本来就为了方便控制外设,所以要添加这个定义,以启用外设驱动。
(2)STM32F10X_HD 如果你使用stm32f10x_stdperiph_lib,会发现在stm32f10x.h文件会有一段关于宏选择的代码,如:
#if !defined (STM32F10X_LD) && !defined (STM32F10X_MD) && !defined (STM32F10X_HD) && !defined (STM32F10X_CL)
/* #define STM32F10X_LD */ /*!< STM32F10X_LD: STM32 Low density devices */
/* #define STM32F10X_MD */ /*!< STM32F10X_MD: STM32 Medium density devices */
/* #define STM32F10X_HD */ /*!< STM32F10X_HD: STM32 High density devices */
#define STM32F10X_CL /*!< STM32F10X_CL: STM32 Connectivity line devices */
#endif
至于要使用哪个宏,则需要根据具体的芯片来进行选择。如果是STM32F105xx和STM32F107xx,是Connectivity Line Devices,则宏定义选择的是STM32F10X_CL;如果是别的型号,则根据FLASH的容量来进行选择。可能文字写的有点不太清楚,还是以表格来说明:宏MCU 型号FLASH大小STM32F10X_LDSTM32F101xxSTM32F102xxSTM32F103xx16 ~ 32 KbytesSTM32F10X_MDSTM32F101xxSTM32F102xxSTM32F103xx64 ~ 128 KbytesSTM32F10X_HDSTM32F101xxSTM32F103xx256 ~ 512 KbytesSTM32F10X_CLSTM32F105xxSTM32F107xx忽略
一周热门 更多>