GPIO State (0x0C,0x42)

Description

Allows the state of the pin to be read or controlled.

Notes

This command serves two purposes: 1) To allow reading the state of a pin via command, rather than polling a data quantity, and 2) to provide a way to set the output state without also having to specify the operating mode.

The state read back from the pin is the physical state of the pin, rather than a configuration value. The state can be read regardless of its configuration as long as the device supports GPIO input on that pin. If the pin is set to an output, the read value would match the output value.

While the state of a pin can always be set, it will only have an observable effect if the pin is set to output mode.

This command does not support saving, loading, or resetting the state. Instead, use the GPIO Configuration command, which allows the initial state to be configured.

Parameter Name Data Type Description
Field Length u8 5
Descriptor u8 0x42
Function Selector u8 This command supports the following MIP function selectors:
Write Read [WR]
Pin [WR] u8 GPIO pin number counting from 1. Cannot be 0.
State [W] bool The pin state.
Ack/Nack Reply See standard MIP ack/nack reply format.
Response Data Data Type Description
Response Length u8 4
Response Descriptor u8 0xC2
Pin u8 GPIO pin number counting from 1. Cannot be 0.
State bool The pin state.