Eris Linux A.P.I. 0.1
API to access Eris Linux system from a custom container
Loading...
Searching...
No Matches
GPIO

Functions to communicate with equipments using GPIO. More...

Functions

int eris_get_list_of_gpio (char *buffer, size_t size)
 Get a list of available GPIOs.
int eris_request_gpio_for_input (const char *id)
 Reserve a GPIO and configure it for input.
int eris_request_gpio_for_output (const char *id, int value)
 Configure a GPIO for output and set its initial value.
int eris_release_gpio (const char *id)
 Release a GPIO that you don't use anymore.
int eris_read_gpio_value (const char *id)
 Read the value on a GPIO configured in input.
int eris_write_gpio_value (const char *id, int value)
 Write a value on a GPIO configured in output.

Detailed Description

Functions to communicate with equipments using GPIO.

Function Documentation

◆ eris_get_list_of_gpio()

int eris_get_list_of_gpio ( char * buffer,
size_t size )

Get a list of available GPIOs.

Parameters
bufferThe buffer to fill with the list.
sizeThe 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
idThe id of the GPIO.
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
idThe id of the GPIO.
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
idThe id of 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_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
idThe name of the GPIO.
valueThe 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
idThe id of the GPIO.
valueThe value (0 or 1) to write to the GPIO.
Returns
0 on success, -1 on error and errno is set appropriately.