GPIO_Pin_8 选中引脚8 GPIO_Pin_9 选中引脚9 GPIO_Pin_10 选中引脚10 GPIO_Pin_11 选中引脚11 GPIO_Pin_12 选中引脚12 GPIO_Pin_13 选中引脚13 GPIO_Pin_14 选中引脚14 GPIO_Pin_15 选中引脚15 GPIO_Pin_All 选中全部引脚 ---***--- 引脚速度这样设置: GPIO_InitStructure.GPIO_Speed = GPIO_Speed...
void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct); 2个读取输入电平函数: uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx); 2个读取输出电平函数: uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx...
下面我们来看一看他们各自是如何好、实现的因为HAL_GPIO_Write已经介绍过了所以我们从另一个常用函数开始介绍——HAL_GPIO_ReadPin(); GPIO_PinStateHAL_GPIO_ReadPin(GPIO_TypeDef*GPIOx,uint16_t GPIO_Pin){GPIO_PinState bitstatus;/* Check the parameters */assert_param(IS_GPIO_PIN(GPIO_Pin));if((GP...
void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct); GPIOx :一个指向 GPIO_TypeDef 类型结构体的指针,表示要被初始化的GPIO端口(如GPIOA、GPIOB等)。 GPIO_InitStruct:一个指向 GPIO_InitTypeDef类型结构体的指针,表示要应用于指定GPIO端口的配置信息。该结构体成员变量有GPIO引脚号,GPIO...
;//GPIO口写入状态voidGPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal);//GPIO口写入16BIT状态voidGPIO_ToggleBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);//GPIO口某位取反/*GPIO映射配置函数 ***/voidGPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF); ...
void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal); ⑥设置一组IO口为高或低电平 void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal); ⑦读取一个引脚的输入值 uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); ...
void GPIO_Init( GPIOA, &GPIO_InitStructure);选择前面配置的端口和结构体地址 void GPIO_SetBits( GPIOA, GPIO_Pin_2);对应端口为高电平 void GPIO_ResetBits(GPIOA, GPIO_Pin_2);对应端口为低电平 void GPIO_WriteBit(GPIOx, GPIO_Pin_x, RESET低/SET高电平 ); void GPIO_Write( GPIOx, 16进制地址...
图1 GPIO应用设计 二、API函数 STM32有多种类型的库,本节所介绍的STM32的GPIO函数接口是STM32标准库的函数接口,接口总共分为4种类型,如图2所示。 图2 GPIO库函数接口分类 1、关键参数 在详细介绍各个API函数接口功能之前,我们需要对函数接口中使用到的关键的几个参数进行分析。
8个等按顺序点亮//甚至可以定义一个数组依次给第二个参数位置实现花式点灯GPIO_Write(GPIOA,~0x0001);...