1.8.13.2 1.25.10.2 1.26.9.2 1.27.11.2 1.28.13.2 1.34.10.2 1.35.8.2 1.36.11.2 1.41.12.2 1.42.10.2 PIO_PortRead Function

C

uint32_t PIO_PortRead(PIO_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 levels.

  • 1 - Pin is high.

  • 0 - Pin is low.

This function reads the value regardless of pin configuration, whether it is set as as an input, driven by the PIO Controller, or driven by a peripheral.

Precondition

Reading the I/O line levels requires the clock of the PIO Controller to be enabled, otherwise this API reads the levels present on the I/O line at the time the clock was disabled.

Parameters

Param Description
port One of the IO ports from the enum PIO_PORT

Returns

Returns the read value of all the I/O lines of the selected port port.

Example

uint32_t value;
value = PIO_PortRead(PIO_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.