-
Notifications
You must be signed in to change notification settings - Fork 1
Gpioextension
The GPIO extension is largely provided for experimentation. Most pins which are dedicated for a particular purpose (such as specific digital inputs or outputs) can be assigned by the client configuration to the standard fixed function device types.
However, there are times where it is useful to provide the host software with direct access to the dyamically configurable GPIO pin functionality. For instance, with the GPIO extension a single pin can be used as an analogue input, an analogue output, a PWM output, digital input, digital output or open drain input-output simply by changing its active configuration.
The following is a list of currently defined GPIO pin modes:
Value | Mode |
---|---|
0x01 |
High Impedance |
0x02 |
Digital Input |
0x03 |
Digital Output |
0x04 |
Analog Input |
0x05 |
Analog Output |
0x06 |
PWM Output |
0x07 |
Open Drain Input-Output (with pull-up). |
Note: the Analog Output GPIO mode should not be advertise if the analogue output level is provided simply through a raw PWM signal (e.g., as on AVR-based Arduinos).
Any digital write, digital read or PWM write should use the standard Pacemaker functions for this purpose.
This order returns the modes supported by the specified GPIO pin.
Byte Number | Content |
---|---|
0 |
device number |
-
OK: The reply parameter contains a list of supported GPIO Pin Modes (1 value per byte).
This order sets a GPIO into the requested mode.
Byte Number | Content |
---|---|
0 |
device number |
1 |
mode |
-
OK: The reply parameter contains no data.
-
Bad Parameter Value: the requested mode is not supported for the specified pin.
This order performs an analog read of a GPIO pin. The value read is mapped onto a 16-bit range.
Byte Number | Content |
---|---|
0 |
device number |
-
OK: The reply parameter contains the analog value read as a 2 byte integer.
-
Bad Parameter Value: the requested mode is not supported for the specified pin.
This order performs an analog write on a GPIO pin. The value to write is mapped into a 16-bit range regardless of the underlying device precision.
Byte Number | Content |
---|---|
0 |
device number |
1 |
analog value to write (MSB) |
2 |
analog value to write (LSB) |
This order can also be queued using the Queue Command Wrapper if the basic move extension is supported.
-
OK: The reply parameter contains no data.
-
Bad Parameter Value: the requested mode is not supported for the specified pin.