Functions and data structures dealing with GPIO chips.
More...
Functions and data structures dealing with GPIO chips.
◆ gpiod_chip_close()
void gpiod_chip_close |
( |
struct gpiod_chip * |
chip | ) |
|
Close a GPIO chip handle and release all allocated resources.
- Parameters
-
chip | The GPIO chip object. |
◆ gpiod_chip_get_line()
struct gpiod_line* gpiod_chip_get_line |
( |
struct gpiod_chip * |
chip, |
|
|
unsigned int |
offset |
|
) |
| |
Get the handle to the GPIO line at given offset.
- Parameters
-
chip | The GPIO chip object. |
offset | The offset of the GPIO line. |
- Returns
- Pointer to the GPIO line handle or NULL if an error occured.
◆ gpiod_chip_label()
const char* gpiod_chip_label |
( |
struct gpiod_chip * |
chip | ) |
|
Get the GPIO chip label as represented in the kernel.
- Parameters
-
chip | The GPIO chip object. |
- Returns
- Pointer to a human-readable string containing the chip label.
◆ gpiod_chip_name()
const char* gpiod_chip_name |
( |
struct gpiod_chip * |
chip | ) |
|
Get the GPIO chip name as represented in the kernel.
- Parameters
-
chip | The GPIO chip object. |
- Returns
- Pointer to a human-readable string containing the chip name.
◆ gpiod_chip_num_lines()
unsigned int gpiod_chip_num_lines |
( |
struct gpiod_chip * |
chip | ) |
|
Get the number of GPIO lines exposed by this chip.
- Parameters
-
chip | The GPIO chip object. |
- Returns
- Number of GPIO lines.
◆ gpiod_chip_open()
struct gpiod_chip* gpiod_chip_open |
( |
const char * |
path | ) |
|
Open a gpiochip by path.
- Parameters
-
path | Path to the gpiochip device file. |
- Returns
- GPIO chip handle or NULL if an error occurred.
◆ gpiod_chip_open_by_label()
struct gpiod_chip* gpiod_chip_open_by_label |
( |
const char * |
label | ) |
|
Open a gpiochip by label.
- Parameters
-
label | Label of the gpiochip to open. |
- Returns
- GPIO chip handle or NULL if the chip with given label was not found or an error occured.
◆ gpiod_chip_open_by_name()
struct gpiod_chip* gpiod_chip_open_by_name |
( |
const char * |
name | ) |
|
Open a gpiochip by name.
- Parameters
-
name | Name of the gpiochip to open. |
- Returns
- GPIO chip handle or NULL if an error occurred.
This routine appends name to '/dev/' to create the path.
◆ gpiod_chip_open_by_number()
struct gpiod_chip* gpiod_chip_open_by_number |
( |
unsigned int |
num | ) |
|
Open a gpiochip by number.
- Parameters
-
num | Number of the gpiochip. |
- Returns
- GPIO chip handle or NULL if an error occurred.
This routine appends num to '/dev/gpiochip' to create the path.
◆ gpiod_chip_open_lookup()
struct gpiod_chip* gpiod_chip_open_lookup |
( |
const char * |
descr | ) |
|
Open a gpiochip based on the best guess what the path is.
- Parameters
-
descr | String describing the gpiochip. |
- Returns
- GPIO chip handle or NULL if an error occurred.
This routine tries to figure out whether the user passed it the path to the GPIO chip, its name, label or number as a string. Then it tries to open it using one of the other gpiod_chip_open** routines.