GPIO
Commands that provide access to GPIO data and functions.
Get Current State
Get the current state of the instrument's channel
Command
- gpio - (Object) - The gpio object.
- # - (Array<Object>) - An array of command objects to apply to the gpio channel.
- command - (String) - The Get Current State command: “getCurrentState”
Response
- gpio - (Object) - The gpio object.
- # - (Array<Object>) - An array of command objects applied to the gpio channel.
- command - (String) - The Get Current State command: “getCurrentState”
- statusCode - (Integer) - A numeric value representing the device status. See Digilent Instrumentation Protocol Status Codes
- wait - (Integer) - The number of ms to wait before the device is ready to process another command.
- state - (String) - The GPIO channel state: “idle” or “running”.
- mode - (String) - The GPIO channel mode: “la” or “gpio”.
- direction - (String) - The GPIO channel direction: “input”, “output”, or “tristate”.
- value - (Integer) - The GPIO value: 0 or 1.
Example
Command
{
"gpio": {
"1": [
{
"command":"getCurrentState"
}
]
}
}
Response
{
"gpio": {
"1": [
{
"command":"getCurrentState",
"statusCode": 0,
"wait":0,
"state": "idle",
"mode": "gpio",
"direction": "output",
"value": 1
}
]
}
}
Read
Read the specified GPIO channel(s).
Command
- gpio - (Object) - The GPIO object.
- # - (Array<Object>) - An array of command objects to apply to the GPIO channel.
- command - (String) - The Read command: “read”
Response
- gpio - (Object) - The GPIO object.
- # - (Array<Object>) - An array of command objects applied to the GPIO channel.
- command - (String) - The Read command: “read”
- statusCode - (Integer) - A numeric value representing the device status. See Digilent Instrumentation Protocol Status Codes
- wait - (Integer) - The number of ms to wait before the device is ready to process another command.
- direction - (String) - The GPIO channel's direction (ex. “input”, “output”).
- value - (Integer) - The GPIO channel's value (ex. 0, 1).
Example:
Command
{
"gpio":{
"1":[
{
"command":"read"
}
]
}
}
Response
{
"gpio":{
"1":[
{
"command":"read",
"statusCode":0,
"wait":100,
"direction: "input"
"value":1
}
]
}
}
Set Parameters
Set the parameters (direction) of the specified GPIO channel(s).
Command
- gpio - (Object) - The GPIO object.
- # - (Array<Object>) - An array of command objects to apply to the gpio channel.
- command - (String) - The Set Parameters command: “setParameters”
- direction - (String) - The GPIO direction: “input”, “output”, “inputPullUp”, “inputPullDown”.
Response
- gpio - (Object) - The GPIO object.
- # - (Array<Object>) - An array of command objects applied to the gpio channel.
- command - (String) - The Get Current State command: “getCurrentState”
- statusCode - (Integer) - A numeric value representing the device status. See Digilent Instrumentation Protocol Status Codes
- wait - (Integer) - The number of ms to wait before the device is ready to process another command.
Example:
Command
{
"gpio":{
"1":[
{
"command":"setParameters",
"direction":"input"
}
],
"2":[
{
"command":"setParameters",
"direction":"output"
}
]
}
}
Response
{
"gpio":{
"1":[
{
"command":"setParameters",
"statusCode":0,
"wait":100
}
],
"2":[
{
"command":"setParameters",
"statusCode":0,
"wait":100
}
]
}
}
Write
Write the output voltage(s) of the specified GPIO channel(s).
Command
- gpio - (Object) - The GPIO object.
- # - (Array<Object>) - An array of command objects to apply to the GPIO channel.
- command - (String) - The Write command: “write”
- value - (Integer) - The value to write to the GPIO channel (ex. 0 for logic low, 1 for logic high).
Response
- gpio - (Object) - The GPIO object.
- # - (Array<Object>) - An array of command objects applied to the GPIO channel.
- command - (String) - The Write command: “write”
- statusCode - (Integer) - A numeric value representing the device status. See Digilent Instrumentation Protocol Status Codes
- wait - (Integer) - The number of ms to wait before the device is ready to process another command.
Example:
Command
{
"gpio":{
"1":[
{
"command":"write",
"value":1
}
]
}
}
Response
{
"gpio":{
"1":[
{
"command":"write",
"statusCode":0,
"wait":500
}
]
}
}

