MG32L003 Standard Peripherals Firmware Library

模块 | 宏定义 | 函数
GPIO
MG32L003_StdPeriph_Driver

GPIO driver modules 更多...

## 模块
| GPIO_Exported_Constants
| GPIO_Private_Functions

## 宏定义
#define | IS_GPIO_ALL_PERIPH(PERIPH)
#define | IS_GET_GPIO_PIN(PIN)
#define | IS_GPIO_PIN(PIN) (((PIN) & 0x000000FF) != (uint32_t)0x00)
#define | IS_GPIO_BIT_ACTION(ACTION) (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET))

## 函数
void | GPIO_DeInit (GPIO_TypeDef *GPIOx)
| De-initializes the GPIOx peripheral registers to their default reset values. 更多...
void | GPIO_Init (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t PinConfig)
| Initializes the GPIOx peripheral according to the PinConfig. 更多...
void | GPIO_SetAFPin (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t Alternate)
| Configure gpio alternate function of any pins for a dedicated port. 更多...
uint8_t | GPIO_ReadInputDataBit (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
| Reads the specified input port pin. 更多...
uint16_t | GPIO_ReadInputData (GPIO_TypeDef *GPIOx)
| Reads the specified GPIO input data port. 更多...
uint8_t | GPIO_ReadOutputDataBit (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
| Reads the specified output data port bit. 更多...
uint16_t | GPIO_ReadOutputData (GPIO_TypeDef *GPIOx)
| Reads the specified GPIO output data port. 更多...
void | GPIO_SetBits (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
| Sets the selected data port bits. 更多...
void | GPIO_ResetBits (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
| Clears the selected data port bits. 更多...
void | GPIO_WriteBit (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, BitAction BitVal)
| Sets or clears the selected data port bit. 更多...
void | GPIO_Write (GPIO_TypeDef *GPIOx, uint16_t PortVal)
| Writes data to the specified GPIO data port. 更多...
void | GPIO_ToggleBits (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
| Toggle data value for several pin of specified port. 更多...
void | GPIO_DriveCurrentConfig (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t Current)
| Configure the drive current of several pins for a specified port. 更多...
void | GPIO_EXTIConfig (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t EXTI_Config)
| Handles the configuration of GPIO_Pin's EXTI. 更多...
void | GPIO_DebounceConfig (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t DebounceConfig)
| Handles the configuration of GPIO debounce. 更多...
FlagStatus | GPIO_EXTI_GetFlagStatus (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
| Checks whether the specified GPIO_Pin's EXTI line flag is set or not. 更多...
void | GPIO_EXTI_ClearFlag (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
| Clears the GPIO_Pin's EXTI line pending flags. 更多...
ITStatus | GPIO_EXTI_GetIT (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
| Checks that the interrupt of the EXTI line for the specified GPIO Pin is enabled. 更多...
void | GPIO_EXTI_ClearIT (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
| Clears the GPIO_Pin's EXTI line pending bits. 更多...

## 详细描述

GPIO driver modules

## 宏定义说明

## ◆ IS_GET_GPIO_PIN

#define IS_GET_GPIO_PIN | ( |  | PIN | ) |

值:
(((PIN) == GPIO_Pin_0) || \
((PIN) == GPIO_Pin_1) || \
((PIN) == GPIO_Pin_2) || \
((PIN) == GPIO_Pin_3) || \
((PIN) == GPIO_Pin_4) || \
((PIN) == GPIO_Pin_5) || \
((PIN) == GPIO_Pin_6) || \
((PIN) == GPIO_Pin_7))
GPIO_Pin_2
#define GPIO_Pin_2
Definition: mg32l003_gpio.h:56
GPIO_Pin_0
#define GPIO_Pin_0
Definition: mg32l003_gpio.h:54
GPIO_Pin_4
#define GPIO_Pin_4
Definition: mg32l003_gpio.h:58
GPIO_Pin_1
#define GPIO_Pin_1
Definition: mg32l003_gpio.h:55
GPIO_Pin_7
#define GPIO_Pin_7
Definition: mg32l003_gpio.h:61
GPIO_Pin_5
#define GPIO_Pin_5
Definition: mg32l003_gpio.h:59
GPIO_Pin_6
#define GPIO_Pin_6
Definition: mg32l003_gpio.h:60
GPIO_Pin_3
#define GPIO_Pin_3
Definition: mg32l003_gpio.h:57

## ◆ IS_GPIO_ALL_PERIPH

#define IS_GPIO_ALL_PERIPH | ( |  | PERIPH | ) |

值:
(((PERIPH) == GPIOA) || \
((PERIPH) == GPIOB) || \
((PERIPH) == GPIOC) || \
((PERIPH) == GPIOD))

## 函数说明

## ◆ GPIO_DebounceConfig()

void GPIO_DebounceConfig | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin,
|  | uint32_t | DebounceConfig
| ) |  |

Handles the configuration of GPIO debounce.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the pins to be configured. This parameter can be any combination of GPIO_Pin_x where x can be (0..7).
  DebounceConfig | The port bit configuration. This parameter must be a combination of one GPIO_DB_x flags.

返回值

  None |

## ◆ GPIO_DeInit()

void GPIO_DeInit | ( | GPIO_TypeDef * | GPIOx | ) |

De-initializes the GPIOx peripheral registers to their default reset values.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.

返回值

  None |

## ◆ GPIO_DriveCurrentConfig()

void GPIO_DriveCurrentConfig | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin,
|  | uint32_t | Current
| ) |  |

Configure the drive current of several pins for a specified port.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the pins to be configured. This parameter can be any combination of GPIO_Pin_x where x can be (0..7).
  Current | Specifies the drive current. This parameter can be one of the following values: GPIO_DRV_HIGH: High driving strength. GPIO_DRV_LOW: Low driving strength

返回值

  None |

## ◆ GPIO_EXTI_ClearFlag()

void GPIO_EXTI_ClearFlag | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin
| ) |  |

Clears the GPIO_Pin's EXTI line pending flags.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the pins flags to clear. This parameter can be any combination of GPIO_Pin_x where x can be (0..7).

返回值

  None |

## ◆ GPIO_EXTI_ClearIT()

void GPIO_EXTI_ClearIT | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin
| ) |  |

Clears the GPIO_Pin's EXTI line pending bits.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the GPIO_Pin's EXTI lines to clear. This parameter can be any combination of GPIO_Pin_x where x can be (0..7).

返回值

  None |

## ◆ GPIO_EXTI_GetFlagStatus()

FlagStatus GPIO_EXTI_GetFlagStatus | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin
| ) |  |

Checks whether the specified GPIO_Pin's EXTI line flag is set or not.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | specifies the pins flag to check. This parameter can be any combination of GPIO_Pin_x where x can be (0..7).

返回值

  The | new state of GPIO_Pin's EXTI line (SET or RESET).

## ◆ GPIO_EXTI_GetIT()

ITStatus GPIO_EXTI_GetIT | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin
| ) |  |

Checks that the interrupt of the EXTI line for the specified GPIO Pin is enabled.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the pins to check. This parameter can be any combination of GPIO_Pin_x where x can be (0..7).

返回值

  The | new state of interrupt enabled for the GPIO_Pin's EXTI line (SET or RESET).

## ◆ GPIO_EXTIConfig()

void GPIO_EXTIConfig | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin,
|  | uint32_t | EXTI_Config
| ) |  |

Handles the configuration of GPIO_Pin's EXTI.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the pins to be configured. This parameter can be any combination of GPIO_Pin_x where x can be (0..7).
  EXTI_Config | The port bit configuration. This parameter must be a combination of one GPIO_EXTI_define GPIO_EXTI_x flags.

返回值

  None |

## ◆ GPIO_Init()

void GPIO_Init | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin,
|  | uint32_t | PinConfig
| ) |  |

Initializes the GPIOx peripheral according to the PinConfig.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the port bit to be initialized. This parameter can be any combination of GPIO_Pin_x where x can be (0..7).
  PinConfig | The port bit configuration. This parameter must be a combination of one GPIO_MODE_x flag, one GPIO_OTYPE_x flag, one GPIO_PUPD_x flag, one GPIO_DRV_x flag, one GPIO_SPEED_x flag and one GPIO_AFx flag.

返回值

  None |

## ◆ GPIO_ReadInputData()

uint16_t GPIO_ReadInputData | ( | GPIO_TypeDef * | GPIOx | ) |

Reads the specified GPIO input data port.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.

返回值

  GPIO | input data port value.

## ◆ GPIO_ReadInputDataBit()

uint8_t GPIO_ReadInputDataBit | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin
| ) |  |

Reads the specified input port pin.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the port bit to read. This parameter can be GPIO_Pin_x where x can be (0..7).

返回值

  The | input port pin value.

## ◆ GPIO_ReadOutputData()

uint16_t GPIO_ReadOutputData | ( | GPIO_TypeDef * | GPIOx | ) |

Reads the specified GPIO output data port.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.

返回值

  GPIO | output data port value.

## ◆ GPIO_ReadOutputDataBit()

uint8_t GPIO_ReadOutputDataBit | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin
| ) |  |

Reads the specified output data port bit.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the port bit to read. This parameter can be GPIO_Pin_x where x can be (0..7).

返回值

  The | output port pin value.

## ◆ GPIO_ResetBits()

void GPIO_ResetBits | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin
| ) |  |

Clears the selected data port bits.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the port bits to be written. This parameter can be any combination of GPIO_Pin_x where x can be (0..7).

返回值

  None |

## ◆ GPIO_SetAFPin()

void GPIO_SetAFPin | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin,
|  | uint32_t | Alternate
| ) |  |

Configure gpio alternate function of any pins for a dedicated port.

注解
  Possible values are from AF0 to AF15 depending on target.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the port bits to configure. This parameter can be any combination of GPIO_Pin_x where x can be (0..7).
  Alternate | This parameter can be GPIO_AFx where x can be (0..15).

返回值

  None |

## ◆ GPIO_SetBits()

void GPIO_SetBits | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin
| ) |  |

Sets the selected data port bits.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the port bits to be written. This parameter can be any combination of GPIO_Pin_x where x can be (0..7).

返回值

  None |

## ◆ GPIO_ToggleBits()

void GPIO_ToggleBits | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin
| ) |  |

Toggle data value for several pin of specified port.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the pins to be toggled. This parameter can be any combination of GPIO_Pin_x where x can be (0..7).

返回值

  None |

## ◆ GPIO_Write()

void GPIO_Write | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | PortVal
| ) |  |

Writes data to the specified GPIO data port.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  PortVal | Specifies the value to be written to the port output data register.

返回值

  None |

## ◆ GPIO_WriteBit()

void GPIO_WriteBit | ( | GPIO_TypeDef * | GPIOx,
|  | uint16_t | GPIO_Pin,
|  | BitAction | BitVal
| ) |  |

Sets or clears the selected data port bit.

参数

  GPIOx | Where x can be (A..D) to select the GPIO peripheral.
  GPIO_Pin | Specifies the port bit to be written. This parameter can be one of GPIO_Pin_x where x can be (0..7).
  BitVal | Specifies the value to be written to the selected bit. This parameter can be one of the BitAction enum values: Bit_RESET: to clear the port pin Bit_SET: to set the port pin

返回值

  None |