Quickstart
The shortest path to using GPIO: initialize, then read and write a pin. Binding rules are in Port — Requirements; signatures in API Reference.
Bring the Driver Up
Port_Init(NULL_PTR); /* driver: UNINIT -> INIT; all pins to configured function/direction */
Write and Read a Pin
Address pins through the generated symbols (PORT_PIN_<...>), never raw numbers:
Port_SetPinValue(PORT_PIN_LED, PORT_PIN_VALUE_HIGH); /* drive the LED pin high */
Port_PinValueType v = Port_GetPinValue(PORT_PIN_BUTTON);
if (v == PORT_PIN_VALUE_HIGH) {
/* button pin reads high */
}
Toggle a Pin
Port_PinValueType now = Port_TogglePinValue(PORT_PIN_LED); /* flips LOW<->HIGH, returns new value */
That is a complete round trip. To update several pins of a port at once, see Reading and Writing Pins; to react to pin edges, see Edge Detection.