gpio
Configure a gpio input controller to use a GPIO- or ADC-based device to communicate with your machine.
To be able to test your controller as you configure it, physically connect your controller to your machine’s computer and turn both on.
{
"board": "piboard",
"buttons": {
"interrupt1": {
"control": "ButtonNorth",
"invert": false,
"debounce_msec": 5
},
"interrupt2": {
"control": "ButtonSouth",
"invert": true,
"debounce_msec": 5
}
},
"axes": {
"analog1": {
"control": "AbsoluteX",
"min": 0,
"max": 1023,
"poll_hz": 50,
"deadzone": 30,
"min_change": 5,
"bidirectional": false,
"invert": false
},
"analog2": {
"control": "AbsoluteY",
"min": 0,
"max": 1023,
"poll_hz": 50,
"deadzone": 30,
"min_change": 5,
"bidirectional": true,
"invert": true
}
},
"depends_on": ["piboard"]
}
{
"components": [
{
"name": "<your-gpio-input-controller-name>",
"model": "gpio",
"api": "rdk:component:input_controller",
"attributes": {
"board": "<your-board-name>",
"buttons": {
"<your-button-name>": {
"control": "<button-control-name>",
"invert": <boolean>,
"debounce_msec": <int>
}
},
"axes": {
"<your-axis-name>": {
"control": "<axis-control-name>",
"min": <int>,
"max": <int>,
"poll_hz": <int>,
"deadzone": <int>,
"min_change": <int>,
"bidirectional": <boolean>,
"invert": <boolean>
}
}
},
"depends_on": ["<your-board-name>"]
}
]
}
{
"components": [
{
"name": "my_gpio_ic",
"model": "gpio",
"api": "rdk:component:input_controller",
"attributes": {
"board": "piboard",
"buttons": {
"interrupt1": {
"control": "ButtonNorth",
"invert": false,
"debounce_msec": 5
},
"interrupt2": {
"control": "ButtonSouth",
"invert": true,
"debounce_msec": 5
}
},
"axes": {
"analog1": {
"control": "AbsoluteX",
"min": 0,
"max": 1023,
"poll_hz": 50,
"deadzone": 30,
"min_change": 5,
"bidirectional": false,
"invert": false
},
"analog2": {
"control": "AbsoluteY",
"min": 0,
"max": 1023,
"poll_hz": 50,
"deadzone": 30,
"min_change": 5,
"bidirectional": true,
"invert": true
}
}
},
"depends_on": ["piboard"]
}
]
}
The following attributes are available for gpio input controllers:
| Name | Type | Required? | Description |
|---|---|---|---|
board | string | Required | The name of the board component with GPIO or ADC pins to use as the controlling device. |
buttons | object | Required | The Buttons available for control. These should be connected to the GPIO/ADC board. Each button has the following fields:
|
axes | object | Required | The Axes available for control. These should be connected to the GPIO/ADC board. Each axis has the following fields:
|
Test the input controller
After you configure your input controller, open the input controller’s TEST panel on the CONFIGURE or CONTROL tabs. View the current value of each input on your controller.
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!