GPIO_ReadInputDataBit
时间: 2023-12-07 14:05:10 浏览: 78
GPIO_ReadInputDataBit is a function in the STM32 HAL (Hardware Abstraction Layer) library that is used to read the value of a specific input pin on a GPIO (General Purpose Input/Output) port.
The syntax for the function is:
```c
uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
```
Where:
- `GPIOx` is the GPIO port to which the input pin belongs (e.g., GPIOA, GPIOB, etc.)
- `GPIO_Pin` is the specific input pin to read (e.g., GPIO_PIN_0, GPIO_PIN_1, etc.)
The function returns the value of the input pin, which is either 0 or 1 (low or high).
Example usage:
```c
// Read the value of input pin 5 on GPIOA
uint8_t input_value = GPIO_ReadInputDataBit(GPIOA, GPIO_PIN_5);
```
阅读全文