1.6.13.2 1.7.14.2 1.10.11.2 1.11.11.2 1.12.11.2 1.13.10.2 1.14.10.2 1.15.10.2 1.16.8.2 1.17.8.2 1.18.9.2 1.19.8.2 1.20.8.2 1.21.9.2 1.22.13.2 1.23.12.2 1.24.9.2 GPIO_PortRead Function
C
uint32_t GPIO_PortRead(GPIO_PORT port)
Summary
Read all the I/O lines of the selected port port.
Description
This function reads the live data values on all the I/O lines of the selected port. Bit values returned in each position indicate corresponding pin state.
-
1 - Pin state is HIGH level (1).
-
0 - Pin state is LOW level (0)
This function reads the value regardless of pin configuration, whether it is set as as an input, driven by the GPIO Controller, or driven by a peripheral.
Precondition
Reading the I/O line levels requires the clock of the GPIO Controller to be enabled, otherwise this API reads the levels present on the I/O line at the time the clock was enabled.
Parameters
Param | Description |
---|---|
port | One of the IO ports from the enum GPIO_PORT |
Returns
Returns the read value of all the I/O lines of the selected port port.
Example
uint32_t value; value = GPIO_PortRead(GPIO_PORT_C);
Remarks
If the port has less than 32-bits, unimplemented pins will read as low (0). Implemented pins are Right aligned in the 32-bit return value.