Loading...
Searching...
No Matches
gpiod.h
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* SPDX-FileCopyrightText: 2017-2022 Bartosz Golaszewski <brgl@bgdev.pl> */
#ifndef __LIBGPIOD_GPIOD_H__
#define __LIBGPIOD_GPIOD_H__
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
struct gpiod_chip;
struct gpiod_chip_info;
struct gpiod_line_info;
struct gpiod_line_settings;
struct gpiod_line_config;
struct gpiod_request_config;
struct gpiod_line_request;
struct gpiod_info_event;
struct gpiod_edge_event;
struct gpiod_edge_event_buffer;
struct gpiod_chip *gpiod_chip_open(const char *path);
void gpiod_chip_close(struct gpiod_chip *chip);
struct gpiod_chip_info *gpiod_chip_get_info(struct gpiod_chip *chip);
const char *gpiod_chip_get_path(struct gpiod_chip *chip);
struct gpiod_line_info *gpiod_chip_get_line_info(struct gpiod_chip *chip,
unsigned int offset);
struct gpiod_line_info *gpiod_chip_watch_line_info(struct gpiod_chip *chip,
unsigned int offset);
int gpiod_chip_unwatch_line_info(struct gpiod_chip *chip, unsigned int offset);
int gpiod_chip_get_fd(struct gpiod_chip *chip);
int gpiod_chip_wait_info_event(struct gpiod_chip *chip, int64_t timeout_ns);
struct gpiod_info_event *gpiod_chip_read_info_event(struct gpiod_chip *chip);
int gpiod_chip_get_line_offset_from_name(struct gpiod_chip *chip,
const char *name);
struct gpiod_line_request *
gpiod_chip_request_lines(struct gpiod_chip *chip,
struct gpiod_request_config *req_cfg,
struct gpiod_line_config *line_cfg);
void gpiod_chip_info_free(struct gpiod_chip_info *info);
const char *gpiod_chip_info_get_name(struct gpiod_chip_info *info);
const char *gpiod_chip_info_get_label(struct gpiod_chip_info *info);
size_t gpiod_chip_info_get_num_lines(struct gpiod_chip_info *info);
enum gpiod_line_value {
GPIOD_LINE_VALUE_ERROR = -1,
GPIOD_LINE_VALUE_INACTIVE = 0,
GPIOD_LINE_VALUE_ACTIVE = 1,
};
enum gpiod_line_direction {
GPIOD_LINE_DIRECTION_AS_IS = 1,
GPIOD_LINE_DIRECTION_INPUT,
GPIOD_LINE_DIRECTION_OUTPUT,
};
enum gpiod_line_edge {
GPIOD_LINE_EDGE_NONE = 1,
GPIOD_LINE_EDGE_RISING,
GPIOD_LINE_EDGE_FALLING,
GPIOD_LINE_EDGE_BOTH,
};
enum gpiod_line_bias {
GPIOD_LINE_BIAS_AS_IS = 1,
GPIOD_LINE_BIAS_UNKNOWN,
GPIOD_LINE_BIAS_DISABLED,
GPIOD_LINE_BIAS_PULL_UP,
GPIOD_LINE_BIAS_PULL_DOWN,
};
enum gpiod_line_drive {
GPIOD_LINE_DRIVE_PUSH_PULL = 1,
GPIOD_LINE_DRIVE_OPEN_DRAIN,
GPIOD_LINE_DRIVE_OPEN_SOURCE,
};
enum gpiod_line_clock {
GPIOD_LINE_CLOCK_MONOTONIC = 1,
GPIOD_LINE_CLOCK_REALTIME,
GPIOD_LINE_CLOCK_HTE,
};
void gpiod_line_info_free(struct gpiod_line_info *info);
struct gpiod_line_info *gpiod_line_info_copy(struct gpiod_line_info *info);
unsigned int gpiod_line_info_get_offset(struct gpiod_line_info *info);
const char *gpiod_line_info_get_name(struct gpiod_line_info *info);
bool gpiod_line_info_is_used(struct gpiod_line_info *info);
const char *gpiod_line_info_get_consumer(struct gpiod_line_info *info);
enum gpiod_line_direction
gpiod_line_info_get_direction(struct gpiod_line_info *info);
enum gpiod_line_edge
gpiod_line_info_get_edge_detection(struct gpiod_line_info *info);
enum gpiod_line_bias
gpiod_line_info_get_bias(struct gpiod_line_info *info);
enum gpiod_line_drive
gpiod_line_info_get_drive(struct gpiod_line_info *info);
bool gpiod_line_info_is_active_low(struct gpiod_line_info *info);
bool gpiod_line_info_is_debounced(struct gpiod_line_info *info);
unsigned long
gpiod_line_info_get_debounce_period_us(struct gpiod_line_info *info);
enum gpiod_line_clock
gpiod_line_info_get_event_clock(struct gpiod_line_info *info);
enum gpiod_info_event_type {
GPIOD_INFO_EVENT_LINE_REQUESTED = 1,
GPIOD_INFO_EVENT_LINE_RELEASED,
GPIOD_INFO_EVENT_LINE_CONFIG_CHANGED,
};
void gpiod_info_event_free(struct gpiod_info_event *event);
enum gpiod_info_event_type
gpiod_info_event_get_event_type(struct gpiod_info_event *event);
uint64_t gpiod_info_event_get_timestamp_ns(struct gpiod_info_event *event);
struct gpiod_line_info *
gpiod_info_event_get_line_info(struct gpiod_info_event *event);
struct gpiod_line_settings *gpiod_line_settings_new(void);
void gpiod_line_settings_free(struct gpiod_line_settings *settings);
void gpiod_line_settings_reset(struct gpiod_line_settings *settings);
struct gpiod_line_settings *
gpiod_line_settings_copy(struct gpiod_line_settings *settings);
int gpiod_line_settings_set_direction(struct gpiod_line_settings *settings,
enum gpiod_line_direction direction);
enum gpiod_line_direction
gpiod_line_settings_get_direction(struct gpiod_line_settings *settings);
int gpiod_line_settings_set_edge_detection(struct gpiod_line_settings *settings,
enum gpiod_line_edge edge);
enum gpiod_line_edge
gpiod_line_settings_get_edge_detection(struct gpiod_line_settings *settings);
int gpiod_line_settings_set_bias(struct gpiod_line_settings *settings,
enum gpiod_line_bias bias);
enum gpiod_line_bias
gpiod_line_settings_get_bias(struct gpiod_line_settings *settings);
int gpiod_line_settings_set_drive(struct gpiod_line_settings *settings,
enum gpiod_line_drive drive);
enum gpiod_line_drive
gpiod_line_settings_get_drive(struct gpiod_line_settings *settings);
void gpiod_line_settings_set_active_low(struct gpiod_line_settings *settings,
bool active_low);
bool gpiod_line_settings_get_active_low(struct gpiod_line_settings *settings);
void
gpiod_line_settings_set_debounce_period_us(struct gpiod_line_settings *settings,
unsigned long period);
unsigned long
gpiod_line_settings_get_debounce_period_us(
struct gpiod_line_settings *settings);
int gpiod_line_settings_set_event_clock(struct gpiod_line_settings *settings,
enum gpiod_line_clock event_clock);
enum gpiod_line_clock
gpiod_line_settings_get_event_clock(struct gpiod_line_settings *settings);
int gpiod_line_settings_set_output_value(struct gpiod_line_settings *settings,
enum gpiod_line_value value);
enum gpiod_line_value
gpiod_line_settings_get_output_value(struct gpiod_line_settings *settings);
struct gpiod_line_config *gpiod_line_config_new(void);
void gpiod_line_config_free(struct gpiod_line_config *config);
void gpiod_line_config_reset(struct gpiod_line_config *config);
int gpiod_line_config_add_line_settings(struct gpiod_line_config *config,
const unsigned int *offsets,
size_t num_offsets,
struct gpiod_line_settings *settings);
struct gpiod_line_settings *
gpiod_line_config_get_line_settings(struct gpiod_line_config *config,
unsigned int offset);
int gpiod_line_config_set_output_values(struct gpiod_line_config *config,
const enum gpiod_line_value *values,
size_t num_values);
size_t
gpiod_line_config_get_num_configured_offsets(struct gpiod_line_config *config);
size_t
gpiod_line_config_get_configured_offsets(struct gpiod_line_config *config,
unsigned int *offsets,
size_t max_offsets);
struct gpiod_request_config *gpiod_request_config_new(void);
void gpiod_request_config_free(struct gpiod_request_config *config);
void gpiod_request_config_set_consumer(struct gpiod_request_config *config,
const char *consumer);
const char *
gpiod_request_config_get_consumer(struct gpiod_request_config *config);
void
gpiod_request_config_set_event_buffer_size(struct gpiod_request_config *config,
size_t event_buffer_size);
size_t
gpiod_request_config_get_event_buffer_size(struct gpiod_request_config *config);
void gpiod_line_request_release(struct gpiod_line_request *request);
const char *
gpiod_line_request_get_chip_name(struct gpiod_line_request *request);
size_t
gpiod_line_request_get_num_requested_lines(struct gpiod_line_request *request);
size_t
gpiod_line_request_get_requested_offsets(struct gpiod_line_request *request,
unsigned int *offsets,
size_t max_offsets);
enum gpiod_line_value
gpiod_line_request_get_value(struct gpiod_line_request *request,
unsigned int offset);
int gpiod_line_request_get_values_subset(struct gpiod_line_request *request,
size_t num_values,
const unsigned int *offsets,
enum gpiod_line_value *values);
int gpiod_line_request_get_values(struct gpiod_line_request *request,
enum gpiod_line_value *values);
int gpiod_line_request_set_value(struct gpiod_line_request *request,
unsigned int offset,
enum gpiod_line_value value);
int gpiod_line_request_set_values_subset(struct gpiod_line_request *request,
size_t num_values,
const unsigned int *offsets,
const enum gpiod_line_value *values);
int gpiod_line_request_set_values(struct gpiod_line_request *request,
const enum gpiod_line_value *values);
int gpiod_line_request_reconfigure_lines(struct gpiod_line_request *request,
struct gpiod_line_config *config);
int gpiod_line_request_get_fd(struct gpiod_line_request *request);
int gpiod_line_request_wait_edge_events(struct gpiod_line_request *request,
int64_t timeout_ns);
int gpiod_line_request_read_edge_events(struct gpiod_line_request *request,
struct gpiod_edge_event_buffer *buffer,
size_t max_events);
enum gpiod_edge_event_type {
GPIOD_EDGE_EVENT_RISING_EDGE = 1,
GPIOD_EDGE_EVENT_FALLING_EDGE,
};
void gpiod_edge_event_free(struct gpiod_edge_event *event);
struct gpiod_edge_event *gpiod_edge_event_copy(struct gpiod_edge_event *event);
enum gpiod_edge_event_type
gpiod_edge_event_get_event_type(struct gpiod_edge_event *event);
uint64_t gpiod_edge_event_get_timestamp_ns(struct gpiod_edge_event *event);
unsigned int gpiod_edge_event_get_line_offset(struct gpiod_edge_event *event);
unsigned long gpiod_edge_event_get_global_seqno(struct gpiod_edge_event *event);
unsigned long gpiod_edge_event_get_line_seqno(struct gpiod_edge_event *event);
struct gpiod_edge_event_buffer *
gpiod_edge_event_buffer_new(size_t capacity);
size_t
gpiod_edge_event_buffer_get_capacity(struct gpiod_edge_event_buffer *buffer);
void gpiod_edge_event_buffer_free(struct gpiod_edge_event_buffer *buffer);
struct gpiod_edge_event *
gpiod_edge_event_buffer_get_event(struct gpiod_edge_event_buffer *buffer,
unsigned long index);
size_t
gpiod_edge_event_buffer_get_num_events(struct gpiod_edge_event_buffer *buffer);
bool gpiod_is_gpiochip_device(const char *path);
const char *gpiod_api_version(void);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __LIBGPIOD_GPIOD_H__ */
gpiod_chip_info_get_label
const char * gpiod_chip_info_get_label(struct gpiod_chip_info *info)
Get the label of the chip as represented in the kernel.
gpiod_chip_info_free
void gpiod_chip_info_free(struct gpiod_chip_info *info)
Free a chip info object and release all associated resources.
gpiod_chip_info_get_name
const char * gpiod_chip_info_get_name(struct gpiod_chip_info *info)
Get the name of the chip as represented in the kernel.
gpiod_chip_info_get_num_lines
size_t gpiod_chip_info_get_num_lines(struct gpiod_chip_info *info)
Get the number of lines exposed by the chip.
gpiod_chip_watch_line_info
struct gpiod_line_info * gpiod_chip_watch_line_info(struct gpiod_chip *chip, unsigned int offset)
Get a snapshot of the status of a line and start watching it for future changes.
gpiod_chip_get_info
struct gpiod_chip_info * gpiod_chip_get_info(struct gpiod_chip *chip)
Get information about the chip.
gpiod_chip_read_info_event
struct gpiod_info_event * gpiod_chip_read_info_event(struct gpiod_chip *chip)
Read a single line status change event from the chip.
gpiod_chip_wait_info_event
int gpiod_chip_wait_info_event(struct gpiod_chip *chip, int64_t timeout_ns)
Wait for line status change events on any of the watched lines on the chip.
gpiod_chip_get_fd
int gpiod_chip_get_fd(struct gpiod_chip *chip)
Get the file descriptor associated with the chip.
gpiod_chip_get_line_offset_from_name
int gpiod_chip_get_line_offset_from_name(struct gpiod_chip *chip, const char *name)
Map a line's name to its offset within the chip.
gpiod_chip_close
void gpiod_chip_close(struct gpiod_chip *chip)
Close the chip and release all associated resources.
gpiod_chip_get_line_info
struct gpiod_line_info * gpiod_chip_get_line_info(struct gpiod_chip *chip, unsigned int offset)
Get a snapshot of information about a line.
gpiod_chip_request_lines
struct gpiod_line_request * gpiod_chip_request_lines(struct gpiod_chip *chip, struct gpiod_request_config *req_cfg, struct gpiod_line_config *line_cfg)
Request a set of lines for exclusive usage.
gpiod_chip_unwatch_line_info
int gpiod_chip_unwatch_line_info(struct gpiod_chip *chip, unsigned int offset)
Stop watching a line for status changes.
gpiod_chip_open
struct gpiod_chip * gpiod_chip_open(const char *path)
Open a chip by path.
gpiod_chip_get_path
const char * gpiod_chip_get_path(struct gpiod_chip *chip)
Get the path used to open the chip.
gpiod_edge_event_buffer_new
struct gpiod_edge_event_buffer * gpiod_edge_event_buffer_new(size_t capacity)
Create a new edge event buffer.
gpiod_edge_event_get_line_offset
unsigned int gpiod_edge_event_get_line_offset(struct gpiod_edge_event *event)
Get the offset of the line which triggered the event.
gpiod_edge_event_copy
struct gpiod_edge_event * gpiod_edge_event_copy(struct gpiod_edge_event *event)
Copy the edge event object.
gpiod_edge_event_get_timestamp_ns
uint64_t gpiod_edge_event_get_timestamp_ns(struct gpiod_edge_event *event)
Get the timestamp of the event.
gpiod_edge_event_buffer_get_event
struct gpiod_edge_event * gpiod_edge_event_buffer_get_event(struct gpiod_edge_event_buffer *buffer, unsigned long index)
Get an event stored in the buffer.
gpiod_edge_event_type
gpiod_edge_event_type
Event types.
Definition gpiod.h:1179
gpiod_edge_event_get_line_seqno
unsigned long gpiod_edge_event_get_line_seqno(struct gpiod_edge_event *event)
Get the event sequence number specific to the line.
gpiod_edge_event_buffer_free
void gpiod_edge_event_buffer_free(struct gpiod_edge_event_buffer *buffer)
Free the edge event buffer and release all associated resources.
gpiod_edge_event_buffer_get_capacity
size_t gpiod_edge_event_buffer_get_capacity(struct gpiod_edge_event_buffer *buffer)
Get the capacity (the max number of events that can be stored) of the event buffer.
gpiod_edge_event_get_global_seqno
unsigned long gpiod_edge_event_get_global_seqno(struct gpiod_edge_event *event)
Get the global sequence number of the event.
gpiod_edge_event_buffer_get_num_events
size_t gpiod_edge_event_buffer_get_num_events(struct gpiod_edge_event_buffer *buffer)
Get the number of events a buffer has stored.
gpiod_edge_event_get_event_type
enum gpiod_edge_event_type gpiod_edge_event_get_event_type(struct gpiod_edge_event *event)
Get the event type.
gpiod_edge_event_free
void gpiod_edge_event_free(struct gpiod_edge_event *event)
Free the edge event object.
GPIOD_EDGE_EVENT_FALLING_EDGE
@ GPIOD_EDGE_EVENT_FALLING_EDGE
Definition gpiod.h:1182
GPIOD_EDGE_EVENT_RISING_EDGE
@ GPIOD_EDGE_EVENT_RISING_EDGE
Definition gpiod.h:1180
gpiod_line_config_get_num_configured_offsets
size_t gpiod_line_config_get_num_configured_offsets(struct gpiod_line_config *config)
Get the number of configured line offsets.
gpiod_line_config_get_line_settings
struct gpiod_line_settings * gpiod_line_config_get_line_settings(struct gpiod_line_config *config, unsigned int offset)
Get line settings for offset.
gpiod_line_config_get_configured_offsets
size_t gpiod_line_config_get_configured_offsets(struct gpiod_line_config *config, unsigned int *offsets, size_t max_offsets)
Get configured offsets.
gpiod_line_config_add_line_settings
int gpiod_line_config_add_line_settings(struct gpiod_line_config *config, const unsigned int *offsets, size_t num_offsets, struct gpiod_line_settings *settings)
Add line settings for a set of offsets.
gpiod_line_config_new
struct gpiod_line_config * gpiod_line_config_new(void)
Create a new line config object.
gpiod_line_config_free
void gpiod_line_config_free(struct gpiod_line_config *config)
Free the line config object and release all associated resources.
gpiod_line_config_reset
void gpiod_line_config_reset(struct gpiod_line_config *config)
Reset the line config object.
gpiod_line_config_set_output_values
int gpiod_line_config_set_output_values(struct gpiod_line_config *config, const enum gpiod_line_value *values, size_t num_values)
Set output values for a number of lines.
gpiod_line_clock
gpiod_line_clock
Clock settings.
Definition gpiod.h:384
gpiod_line_bias
gpiod_line_bias
Internal bias settings.
Definition gpiod.h:356
gpiod_line_edge
gpiod_line_edge
Edge detection settings.
Definition gpiod.h:342
gpiod_line_direction
gpiod_line_direction
Direction settings.
Definition gpiod.h:329
gpiod_line_value
gpiod_line_value
Logical line state.
Definition gpiod.h:317
gpiod_line_drive
gpiod_line_drive
Drive settings.
Definition gpiod.h:372
GPIOD_LINE_CLOCK_REALTIME
@ GPIOD_LINE_CLOCK_REALTIME
Definition gpiod.h:387
GPIOD_LINE_CLOCK_HTE
@ GPIOD_LINE_CLOCK_HTE
Definition gpiod.h:389
GPIOD_LINE_CLOCK_MONOTONIC
@ GPIOD_LINE_CLOCK_MONOTONIC
Definition gpiod.h:385
GPIOD_LINE_BIAS_AS_IS
@ GPIOD_LINE_BIAS_AS_IS
Definition gpiod.h:357
GPIOD_LINE_BIAS_UNKNOWN
@ GPIOD_LINE_BIAS_UNKNOWN
Definition gpiod.h:359
GPIOD_LINE_BIAS_PULL_UP
@ GPIOD_LINE_BIAS_PULL_UP
Definition gpiod.h:363
GPIOD_LINE_BIAS_PULL_DOWN
@ GPIOD_LINE_BIAS_PULL_DOWN
Definition gpiod.h:365
GPIOD_LINE_BIAS_DISABLED
@ GPIOD_LINE_BIAS_DISABLED
Definition gpiod.h:361
GPIOD_LINE_EDGE_NONE
@ GPIOD_LINE_EDGE_NONE
Definition gpiod.h:343
GPIOD_LINE_EDGE_FALLING
@ GPIOD_LINE_EDGE_FALLING
Definition gpiod.h:347
GPIOD_LINE_EDGE_RISING
@ GPIOD_LINE_EDGE_RISING
Definition gpiod.h:345
GPIOD_LINE_EDGE_BOTH
@ GPIOD_LINE_EDGE_BOTH
Definition gpiod.h:349
GPIOD_LINE_DIRECTION_AS_IS
@ GPIOD_LINE_DIRECTION_AS_IS
Definition gpiod.h:330
GPIOD_LINE_DIRECTION_INPUT
@ GPIOD_LINE_DIRECTION_INPUT
Definition gpiod.h:332
GPIOD_LINE_DIRECTION_OUTPUT
@ GPIOD_LINE_DIRECTION_OUTPUT
Definition gpiod.h:335
GPIOD_LINE_VALUE_INACTIVE
@ GPIOD_LINE_VALUE_INACTIVE
Definition gpiod.h:320
GPIOD_LINE_VALUE_ACTIVE
@ GPIOD_LINE_VALUE_ACTIVE
Definition gpiod.h:322
GPIOD_LINE_VALUE_ERROR
@ GPIOD_LINE_VALUE_ERROR
Definition gpiod.h:318
GPIOD_LINE_DRIVE_OPEN_SOURCE
@ GPIOD_LINE_DRIVE_OPEN_SOURCE
Definition gpiod.h:377
GPIOD_LINE_DRIVE_PUSH_PULL
@ GPIOD_LINE_DRIVE_PUSH_PULL
Definition gpiod.h:373
GPIOD_LINE_DRIVE_OPEN_DRAIN
@ GPIOD_LINE_DRIVE_OPEN_DRAIN
Definition gpiod.h:375
gpiod_line_info_copy
struct gpiod_line_info * gpiod_line_info_copy(struct gpiod_line_info *info)
Copy a line info object.
gpiod_line_info_free
void gpiod_line_info_free(struct gpiod_line_info *info)
Free a line info object and release all associated resources.
gpiod_line_info_get_event_clock
enum gpiod_line_clock gpiod_line_info_get_event_clock(struct gpiod_line_info *info)
Get the event clock setting used for edge event timestamps for the line.
gpiod_line_info_get_offset
unsigned int gpiod_line_info_get_offset(struct gpiod_line_info *info)
Get the offset of the line.
gpiod_line_info_get_direction
enum gpiod_line_direction gpiod_line_info_get_direction(struct gpiod_line_info *info)
Get the direction setting of the line.
gpiod_line_info_is_debounced
bool gpiod_line_info_is_debounced(struct gpiod_line_info *info)
Check if the line is debounced (either by hardware or by the kernel software debouncer).
gpiod_line_info_get_name
const char * gpiod_line_info_get_name(struct gpiod_line_info *info)
Get the name of the line.
gpiod_line_info_get_consumer
const char * gpiod_line_info_get_consumer(struct gpiod_line_info *info)
Get the name of the consumer of the line.
gpiod_line_info_is_active_low
bool gpiod_line_info_is_active_low(struct gpiod_line_info *info)
Check if the logical value of the line is inverted compared to the physical.
gpiod_line_info_is_used
bool gpiod_line_info_is_used(struct gpiod_line_info *info)
Check if the line is in use.
gpiod_line_info_get_edge_detection
enum gpiod_line_edge gpiod_line_info_get_edge_detection(struct gpiod_line_info *info)
Get the edge detection setting of the line.
gpiod_line_info_get_debounce_period_us
unsigned long gpiod_line_info_get_debounce_period_us(struct gpiod_line_info *info)
Get the debounce period of the line, in microseconds.
gpiod_line_info_get_bias
enum gpiod_line_bias gpiod_line_info_get_bias(struct gpiod_line_info *info)
Get the bias setting of the line.
gpiod_line_info_get_drive
enum gpiod_line_drive gpiod_line_info_get_drive(struct gpiod_line_info *info)
Get the drive setting of the line.
gpiod_line_request_get_requested_offsets
size_t gpiod_line_request_get_requested_offsets(struct gpiod_line_request *request, unsigned int *offsets, size_t max_offsets)
Get the offsets of the lines in the request.
gpiod_line_request_set_value
int gpiod_line_request_set_value(struct gpiod_line_request *request, unsigned int offset, enum gpiod_line_value value)
Set the value of a single requested line.
gpiod_line_request_get_values
int gpiod_line_request_get_values(struct gpiod_line_request *request, enum gpiod_line_value *values)
Get the values of all requested lines.
gpiod_line_request_get_num_requested_lines
size_t gpiod_line_request_get_num_requested_lines(struct gpiod_line_request *request)
Get the number of lines in the request.
gpiod_line_request_release
void gpiod_line_request_release(struct gpiod_line_request *request)
Release the requested lines and free all associated resources.
gpiod_line_request_get_fd
int gpiod_line_request_get_fd(struct gpiod_line_request *request)
Get the file descriptor associated with a line request.
gpiod_line_request_get_values_subset
int gpiod_line_request_get_values_subset(struct gpiod_line_request *request, size_t num_values, const unsigned int *offsets, enum gpiod_line_value *values)
Get the values of a subset of requested lines.
gpiod_line_request_set_values_subset
int gpiod_line_request_set_values_subset(struct gpiod_line_request *request, size_t num_values, const unsigned int *offsets, const enum gpiod_line_value *values)
Set the values of a subset of requested lines.
gpiod_line_request_wait_edge_events
int gpiod_line_request_wait_edge_events(struct gpiod_line_request *request, int64_t timeout_ns)
Wait for edge events on any of the requested lines.
gpiod_line_request_reconfigure_lines
int gpiod_line_request_reconfigure_lines(struct gpiod_line_request *request, struct gpiod_line_config *config)
Update the configuration of lines associated with a line request.
gpiod_line_request_get_value
enum gpiod_line_value gpiod_line_request_get_value(struct gpiod_line_request *request, unsigned int offset)
Get the value of a single requested line.
gpiod_line_request_set_values
int gpiod_line_request_set_values(struct gpiod_line_request *request, const enum gpiod_line_value *values)
Set the values of all lines associated with a request.
gpiod_line_request_get_chip_name
const char * gpiod_line_request_get_chip_name(struct gpiod_line_request *request)
Get the name of the chip this request was made on.
gpiod_line_request_read_edge_events
int gpiod_line_request_read_edge_events(struct gpiod_line_request *request, struct gpiod_edge_event_buffer *buffer, size_t max_events)
Read a number of edge events from a line request.
gpiod_line_settings_set_event_clock
int gpiod_line_settings_set_event_clock(struct gpiod_line_settings *settings, enum gpiod_line_clock event_clock)
Set event clock.
gpiod_line_settings_get_direction
enum gpiod_line_direction gpiod_line_settings_get_direction(struct gpiod_line_settings *settings)
Get direction.
gpiod_line_settings_set_bias
int gpiod_line_settings_set_bias(struct gpiod_line_settings *settings, enum gpiod_line_bias bias)
Set bias.
gpiod_line_settings_reset
void gpiod_line_settings_reset(struct gpiod_line_settings *settings)
Reset the line settings object to its default values.
gpiod_line_settings_get_drive
enum gpiod_line_drive gpiod_line_settings_get_drive(struct gpiod_line_settings *settings)
Get drive.
gpiod_line_settings_get_debounce_period_us
unsigned long gpiod_line_settings_get_debounce_period_us(struct gpiod_line_settings *settings)
Get debounce period.
gpiod_line_settings_get_event_clock
enum gpiod_line_clock gpiod_line_settings_get_event_clock(struct gpiod_line_settings *settings)
Get event clock setting.
gpiod_line_settings_free
void gpiod_line_settings_free(struct gpiod_line_settings *settings)
Free the line settings object and release all associated resources.
gpiod_line_settings_set_edge_detection
int gpiod_line_settings_set_edge_detection(struct gpiod_line_settings *settings, enum gpiod_line_edge edge)
Set edge detection.
gpiod_line_settings_set_debounce_period_us
void gpiod_line_settings_set_debounce_period_us(struct gpiod_line_settings *settings, unsigned long period)
Set debounce period.
gpiod_line_settings_get_output_value
enum gpiod_line_value gpiod_line_settings_get_output_value(struct gpiod_line_settings *settings)
Get the output value.
gpiod_line_settings_set_output_value
int gpiod_line_settings_set_output_value(struct gpiod_line_settings *settings, enum gpiod_line_value value)
Set the output value.
gpiod_line_settings_get_active_low
bool gpiod_line_settings_get_active_low(struct gpiod_line_settings *settings)
Get active-low setting.
gpiod_line_settings_set_active_low
void gpiod_line_settings_set_active_low(struct gpiod_line_settings *settings, bool active_low)
Set active-low setting.
gpiod_line_settings_copy
struct gpiod_line_settings * gpiod_line_settings_copy(struct gpiod_line_settings *settings)
Copy the line settings object.
gpiod_line_settings_get_edge_detection
enum gpiod_line_edge gpiod_line_settings_get_edge_detection(struct gpiod_line_settings *settings)
Get edge detection.
gpiod_line_settings_set_drive
int gpiod_line_settings_set_drive(struct gpiod_line_settings *settings, enum gpiod_line_drive drive)
Set drive.
gpiod_line_settings_get_bias
enum gpiod_line_bias gpiod_line_settings_get_bias(struct gpiod_line_settings *settings)
Get bias.
gpiod_line_settings_set_direction
int gpiod_line_settings_set_direction(struct gpiod_line_settings *settings, enum gpiod_line_direction direction)
Set direction.
gpiod_line_settings_new
struct gpiod_line_settings * gpiod_line_settings_new(void)
Create a new line settings object.
gpiod_info_event_free
void gpiod_info_event_free(struct gpiod_info_event *event)
Free the info event object and release all associated resources.
gpiod_info_event_get_event_type
enum gpiod_info_event_type gpiod_info_event_get_event_type(struct gpiod_info_event *event)
Get the event type of the status change event.
gpiod_info_event_get_timestamp_ns
uint64_t gpiod_info_event_get_timestamp_ns(struct gpiod_info_event *event)
Get the timestamp of the event.
gpiod_info_event_get_line_info
struct gpiod_line_info * gpiod_info_event_get_line_info(struct gpiod_info_event *event)
Get the snapshot of line-info associated with the event.
gpiod_info_event_type
gpiod_info_event_type
Line status change event types.
Definition gpiod.h:561
GPIOD_INFO_EVENT_LINE_RELEASED
@ GPIOD_INFO_EVENT_LINE_RELEASED
Definition gpiod.h:564
GPIOD_INFO_EVENT_LINE_CONFIG_CHANGED
@ GPIOD_INFO_EVENT_LINE_CONFIG_CHANGED
Definition gpiod.h:566
GPIOD_INFO_EVENT_LINE_REQUESTED
@ GPIOD_INFO_EVENT_LINE_REQUESTED
Definition gpiod.h:562
gpiod_api_version
const char * gpiod_api_version(void)
Get the API version of the library as a human-readable string.
gpiod_is_gpiochip_device
bool gpiod_is_gpiochip_device(const char *path)
Check if the file pointed to by path is a GPIO chip character device.
gpiod_request_config_get_event_buffer_size
size_t gpiod_request_config_get_event_buffer_size(struct gpiod_request_config *config)
Get the edge event buffer size for the request config.
gpiod_request_config_new
struct gpiod_request_config * gpiod_request_config_new(void)
Create a new request config object.
gpiod_request_config_set_event_buffer_size
void gpiod_request_config_set_event_buffer_size(struct gpiod_request_config *config, size_t event_buffer_size)
Set the size of the kernel event buffer for the request.
gpiod_request_config_free
void gpiod_request_config_free(struct gpiod_request_config *config)
Free the request config object and release all associated resources.
gpiod_request_config_set_consumer
void gpiod_request_config_set_consumer(struct gpiod_request_config *config, const char *consumer)
Set the consumer name for the request.
gpiod_request_config_get_consumer
const char * gpiod_request_config_get_consumer(struct gpiod_request_config *config)
Get the consumer name configured in the request config.
gpiod_chip_info
gpiod_chip
gpiod_edge_event_buffer
gpiod_edge_event
gpiod_info_event
gpiod_line_config
gpiod_line_info
gpiod_line_request
gpiod_line_settings
gpiod_request_config