libgpiod  1.6.2
Functions
Reading & setting line values

Functions allowing to read and set GPIO line values for single lines and in bulk. More...

Collaboration diagram for Reading & setting line values:

Functions

int gpiod_line_get_value (struct gpiod_line *line) GPIOD_API
 Read current value of a single GPIO line. More...
 
int gpiod_line_get_value_bulk (struct gpiod_line_bulk *bulk, int *values) GPIOD_API
 Read current values of a set of GPIO lines. More...
 
int gpiod_line_set_value (struct gpiod_line *line, int value) GPIOD_API
 Set the value of a single GPIO line. More...
 
int gpiod_line_set_value_bulk (struct gpiod_line_bulk *bulk, const int *values) GPIOD_API
 Set the values of a set of GPIO lines. More...
 

Detailed Description

Functions allowing to read and set GPIO line values for single lines and in bulk.

Function Documentation

◆ gpiod_line_get_value()

int gpiod_line_get_value ( struct gpiod_line *  line)

Read current value of a single GPIO line.

Parameters
lineGPIO line object.
Returns
0 or 1 if the operation succeeds. On error this routine returns -1 and sets the last error number.

◆ gpiod_line_get_value_bulk()

int gpiod_line_get_value_bulk ( struct gpiod_line_bulk bulk,
int *  values 
)

Read current values of a set of GPIO lines.

Parameters
bulkSet of GPIO lines to reserve.
valuesAn array big enough to hold line_bulk->num_lines values.
Returns
0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

If succeeds, this routine fills the values array with a set of values in the same order, the lines are added to line_bulk. If the lines were not previously requested together, the behavior is undefined.

◆ gpiod_line_set_value()

int gpiod_line_set_value ( struct gpiod_line *  line,
int  value 
)

Set the value of a single GPIO line.

Parameters
lineGPIO line object.
valueNew value.
Returns
0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

◆ gpiod_line_set_value_bulk()

int gpiod_line_set_value_bulk ( struct gpiod_line_bulk bulk,
const int *  values 
)

Set the values of a set of GPIO lines.

Parameters
bulkSet of GPIO lines to reserve.
valuesAn array holding line_bulk->num_lines new values for lines. A NULL pointer is interpreted as a logical low for all lines.
Returns
0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

If the lines were not previously requested together, the behavior is undefined.