shitou-341365 发表于 2012-2-10 17:09:01

stm32 固件库

外设声明
文件 stm32f10x_map.h 包含了所有外设的声明,下例为 SPI外设的声明:
#ifndef EXT
#Define EXT extern
#endif
...
#define PERIPH_BASE ((u32)0x40000000)
#define APB1PERIPH_BASE PERIPH_BASE
#define APB2PERIPH_BASE (PERIPH_BASE + 0x10000)
...
/* SPI2 Base Address definition*/
#define SPI2_BASE (APB1PERIPH_BASE + 0x3800)
...
/* SPI2 peripheral declaration*/
#ifndef DEBUG
...
#ifdef _SPI2
#define SPI2 ((SPI_TypeDef *) SPI2_BASE)
#endif /*_SPI2 */
...
#else /* DEBUG */
...
#ifdef _SPI2
EXT SPI_TypeDef *SPI2;  :o这里的外部声明在哪里声明过
#endif /*_SPI2 */
...
#endif /* DEBUG */ 
 
页: [1]
查看完整版本: stm32 固件库