STM32关于GPIO的函数

这些函数是STMicroelectronics(ST公司)提供的用于操作GPIO(通用输入/输出)引脚的函数,用于在STM32微控制器上配置和控制引脚的不同操作。以下是这些函数的中文解释:

  1. void GPIO_DeInit(GPIO_TypeDef* GPIOx);

    • 作用:将指定的GPIO端口恢复到默认设置。
  2. void GPIO_AFIODeInit(void);

    • 作用:将外设映射设置恢复为默认状态,以重新初始化外设映射配置。
  3. void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);

    • 作用:使用提供的配置初始化一个或多个GPIO引脚。
  4. void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);

    • 作用:将GPIO初始化结构体成员设置为默认值,以便稍后使用它进行初始化。
  5. uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);

    • 作用:读取指定引脚的输入状态,返回0或1。
  6. uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx);

    • 作用:读取整个GPIO端口的输入状态。
  7. uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);

    • 作用:读取指定引脚的输出状态,返回0或1。
  8. uint16_t GPIO_ReadOutputData(GPIO_TypeDef* GPIOx);

    • 作用:读取整个GPIO端口的输出状态。
  9. void GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);

    • 作用:将指定引脚置为高电平状态(1)。
  10. void GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);

    • 作用:将指定引脚置为低电平状态(0)。
  11. void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal);

    • 作用:向指定引脚写入特定的位值(0或1)。
  12. void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal);

    • 作用:向整个GPIO端口写入指定值。
  13. void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);

    • 作用:锁定指定引脚的配置,以防止在操作后对其进行更改。
  14. void GPIO_EventOutputConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);

    • 作用:配置GPIO引脚作为事件输出,用于特定的事件通知机制。
  15. void GPIO_EventOutputCmd(FunctionalState NewState);

    • 作用:启用或禁用GPIO事件输出功能。
  16. void GPIO_PinRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState);

    • 作用:重新映射指定引脚,以实现不同的引脚功能。
  17. void GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);

    • 作用:配置外部中断线的GPIO端口和引脚。
  18. void GPIO_ETH_MediaInterfaceConfig(uint32_t GPIO_ETH_MediaInterface);

    • 作用:配置以太网介质接口。

这些函数可以帮助你在STM32微控制器中配置和控制GPIO引脚的各种操作。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值