Bootstrap

11-C语言对寄存器的封装

1:仅通过指针进行封装 :编译可能出错,这个地方只是表示思路

//在基地址基础上加上偏移地址
#define GPIOF_BASE (0x40021400)
#define GPIOF_BASE (0x40021400)
#define GPIOF_BASE (0x40021400)
#define GPIOF_BASE (0x40021400)
#define GPIOF_BASE (0x40021400)
#define GPIOF_BASE (0x40021400)

#define GPIOF_MODER     *(unsigned int *)(GPIOF_BASE+0x40021400)
#define GPIOF_OTYPER     *(unsigned int *)(GPIOF_BASE+0x40021400)
#define GPIOF_OSPEEDR     *(unsigned int *)(GPIOF_BASE+0x40021400)
#define GPIOF_PUPDR     *(unsigned int *)(GPIOF_BASE+0x40021400)
#define GPIOF_IDR     *(unsigned int *)(GPIOF_BASE+0x40021400)
#define GPIOF_ODR     *(unsigned int *)(GPIOF_BASE+0x40021400)
#define GPIOF_BSRR     *(unsigned int *)(GPIOF_BASE+0x40021400)
#define GPIOF_LCKR     *(unsigned int *)(GPIOF_BASE+0x40021400)
#define GPIOF_AFRL     *(unsigned int *)(GPIOF_BASE+0x40021400)
#define GPIOF_AFRH     *(unsigned int *)(GPIOF_BASE+0x40021400)

;