1.4 解析 GPIOx->BSRR = GPIO_Pin 一、GPIO_SetBits的作用 GPIO_SetBits函数用于将某位引脚置1,使其输出高电平。 二、详细解析 1.函数原型 代码如下: void GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) { assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); assert_param(IS_GPIO_PIN(GPIO_Pin))...
void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct); //初始化函数,用来设置4个配置寄存器(可以看上面GPIO端口的寄存器),包括模式、类型、速度、上下拉。 void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct); void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); ...
5.具体要输出的内容(置位复位寄存器:BSRR/数据输出寄存器:ODR),BSRR中的配置内容最终还是输入到ODR中。 GPIO初始化结构体(库函数操作): typedef struct { uint32_t GPIO_Pin; //设置引脚 GPIOMode_TypeDef GPIO_Mode; //设置模式:输入模式,输出模式,复用模式,模拟模式 GPIOSpeed_TypeDef GPIO_Speed; //GPIO的...
#define DIN_1() DIN_GPIO->BSRR = DIN_PIN #define DIN_0() DIN_GPIO->BSRR = ((uint32_t)DIN_PIN << 16U) #define CS_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() #define CS_GPIO GPIOC #define CS_PIN GPIO_PIN_7 #define CS_1() CS_GPIO->BSRR = CS_PIN #define CS_0() CS...