Functions to communicate with equipments using GPIO.
More...
Functions to communicate with equipments using GPIO.
◆ eris_get_list_of_gpio()
| int eris_get_list_of_gpio |
( |
char * | buffer, |
|
|
size_t | size ) |
Get a list of available GPIOs.
- Parameters
-
| buffer | The buffer to fill with the list. |
| size | The size of the buffer. |
- Returns
- 0 on success, -1 on error and errno is set appropriately.
This function fills the provided buffer with a JSON array of items:
[ {
"id": "gpiochip0:17",
"name": "BUTTON_1"
}
]
◆ eris_read_gpio_value()
| int eris_read_gpio_value |
( |
const char * | id | ) |
|
Read the value on a GPIO configured in input.
- Parameters
-
- Returns
- On success this function return 0 or 1 depending on the GPIO input. On error -1 is returned and errno is set appropriately.
◆ eris_release_gpio()
| int eris_release_gpio |
( |
const char * | id | ) |
|
Release a GPIO that you don't use anymore.
- Parameters
-
- Returns
- 0 on success, -1 on error and errno is set appropriately.
◆ eris_request_gpio_for_input()
| int eris_request_gpio_for_input |
( |
const char * | id | ) |
|
Reserve a GPIO and configure it for input.
- Parameters
-
- Returns
- 0 on success, -1 on error and errno is set appropriately.
id is the string contained in the id field of a GPIO object returned by eris_get_list_of_gpio().
◆ eris_request_gpio_for_output()
| int eris_request_gpio_for_output |
( |
const char * | id, |
|
|
int | value ) |
Configure a GPIO for output and set its initial value.
- Parameters
-
| id | The name of the GPIO. |
| value | The new value for the GPIO. |
- Returns
- 0 on success, -1 on error and errno is set appropriately.
`id` is the string contained in the id field of a GPIO object returned by eris_get_list_of_gpio().
◆ eris_write_gpio_value()
| int eris_write_gpio_value |
( |
const char * | id, |
|
|
int | value ) |
Write a value on a GPIO configured in output.
- Parameters
-
| id | The id of the GPIO. |
| value | The value (0 or 1) to write to the GPIO. |
- Returns
- 0 on success, -1 on error and errno is set appropriately.