### Install libgpiod using Ninja Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/building.rst This command installs the compiled libgpiod library and tools. Superuser privileges may be required. To install to a non-standard path, use the --prefix= option with 'meson setup'. ```none ninja install ``` -------------------------------- ### Setup Virtual Environment for Linting Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/python/README.md Creates and activates a Python virtual environment, then installs linting and formatting tools. Requires pip version >= 25.1 for group support. ```bash python3 -m venv venv . venv/bin/activate pip install --group lint ``` -------------------------------- ### Build and Install libgpiod from Source Tarball Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/building.rst This sequence of commands downloads a source tarball, unpacks it, configures the build with meson, compiles the library and tools with ninja, and installs them. Ensure meson, ninja-build, and pkg-config are installed. ```none wget https://mirrors.edge.kernel.org/pub/software/libs/libgpiod/libgpiod-x.y.z.tar.xz tar -xvf ./libgpiod-x.y.z.tar.xz cd ./libgpiod-x.y.z/ mkdir build cd build meson setup .. -Dtools=enabled ninja sudo ninja install ``` -------------------------------- ### Install gpiod Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/python/README.md Installs the official gpiod Python package using pip. Requires python3-dev to be installed beforehand. ```bash pip install gpiod ``` -------------------------------- ### Install gpiod with System Library Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/python/README.md Installs the gpiod Python package while linking against the system's libgpiod library. Requires pip version >= 25.1 for group support. ```bash LINK_SYSTEM_LIBGPIOD=1 pip install gpiod ``` -------------------------------- ### Install python3-dev on Debian/Ubuntu Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/python/README.md Installs the python3-dev package on Debian-based systems using apt, which is a prerequisite for installing the gpiod Python package. ```bash sudo apt install python3-dev ``` -------------------------------- ### Interactive gpioset Usage Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Demonstrates interactive setting, getting, toggling, and exiting GPIO states using the gpioset command with interactive mode enabled. ```none $ gpioset --interactive --unquoted GPIO23=inactive GPIO24=active gpioset> get GPIO23=inactive GPIO24=active gpioset> toggle gpioset> get GPIO23=active GPIO24=inactive gpioset> set GPIO24=1 gpioset> get GPIO23=active GPIO24=active gpioset> toggle gpioset> get GPIO23=inactive GPIO24=inactive gpioset> toggle GPIO23 gpioset> get GPIO23=active GPIO24=inactive gpioset> exit ``` -------------------------------- ### Install Deprecated Pure-Python gpiod Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/python/README.md Installs a specific older version (1.5.4) of the gpiod package, which is a deprecated, unofficial, pure-Python implementation. ```bash pip install gpiod==1.5.4 ``` -------------------------------- ### Monitor GPIO edge events Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpiocli_top.rst Wait for and display edge events on a configured GPIO line. This example monitors the 'foo' line for rising edges. ```none $ gpiocli monitor cos 21763952894920 rising "foo" ``` -------------------------------- ### Get GPIO Chip Information Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/rust/libgpiod/README.md Opens a GPIO chip and retrieves its information, including name, label, and the number of lines. ```rust let chip = Chip::open(&Path::new("/dev/gpiochip0"))?; let info = chip.info()?; println!("{} [{}] ({} lines)", info.name()?, info.label()?, info.num_lines()); ``` -------------------------------- ### Run Linting and Formatting Checks Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/python/README.md Performs type checking with mypy and code style checks/formatting with ruff. Assumes the virtual environment is activated and linting tools are installed. ```bash mypy; ruff format; ruff check ``` -------------------------------- ### Example Git Commit Message Format Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/CONTRIBUTING.md Follow this format for clear and informative git commit messages. Ensure the subject line is concise and imperative, and the body provides detailed explanations. ```git section: explain the commit in one line (use the imperative) Body of commit message is a few lines of text, explaining things in more detail, possibly giving some background about the issue being fixed, etc etc. The body of the commit message can be several paragraphs, and please do proper word-wrap and keep columns shorter than about 74 characters or so. That way "git log" will show things nicely even when it's indented. Make sure you explain your solution and why you're doing what you're doing, as opposed to describing what you're doing. Reviewers and your future self can read the patch, but might not understand why a particular solution was implemented. Reported-by: whoever-reported-it Signed-off-by: Your Name ``` -------------------------------- ### Get Info for Specific GPIO Lines by Name Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Fetches information for particular GPIO lines identified by their names, showing their chip, offset, name, direction, and consumer. ```none $ ./gpioinfo PWR_LED_OFF STATUS_LED_G_CLK GLOBAL_RESET gpiochip0 42 "STATUS_LED_G_CLK" output consumer="led0" gpiochip1 2 "PWR_LED_OFF" output active-low consumer="led1" gpiochip1 3 "GLOBAL_RESET" output ``` -------------------------------- ### Get information about a specific GPIO line Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpiocli_top.rst Retrieve detailed information about a GPIO line, including its name, status, and consumer. ```none $ gpiocli info --chip=gpiochip1 5 gpiochip1 5: "foo" [used,consumer="gpiocli request",managed="request0",output,push-pull] ``` -------------------------------- ### Monitor GPIO Events with Custom Output Format Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Configure gpiomon to use a custom output format string to display specific event details. This example filters for falling edge events. ```none $ gpiomon --format="%e %c %o %l %S" --edges=falling -c gpiochip0 22 2 gpiochip0 22 GPIO22 10946.693481859 2 gpiochip0 22 GPIO22 10947.025347604 2 gpiochip0 22 GPIO22 10947.283716669 2 gpiochip0 22 GPIO22 10947.570109430 ... ``` -------------------------------- ### Run Strict Mypy Checks Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/python/README.md Executes mypy with the --strict flag for more rigorous type checking. Assumes the virtual environment is activated and linting tools are installed. ```bash mypy --strict ``` -------------------------------- ### Get GPIO line value Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpiocli_top.rst Read the current value of a GPIO line. ```none $ gpiocli get foo "foo"=inactive ``` -------------------------------- ### Get GPIO Chip Information Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/python/README.md Retrieves and prints information about a GPIO chip, including its name, label, and the number of lines it manages. Requires opening the chip device. ```python import gpiod with gpiod.Chip("/dev/gpiochip0") as chip: info = chip.get_info() print(f"{info.name} [{info.label}] ({info.num_lines} lines)") ``` -------------------------------- ### gpiod.LineRequest Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/python_line_request.rst The gpiod.LineRequest class provides an interface for requesting and managing GPIO lines. It exposes various members for interacting with these lines, such as getting their values, setting them, and handling events. ```APIDOC ## gpiod.LineRequest ### Description Represents a request for one or more GPIO lines. This class provides methods to interact with the requested lines, including reading and writing their values, and subscribing to line events. ### Class Members This class has members that allow users to: - Get information about the requested lines. - Read the current value of the lines. - Set the value of the lines. - Subscribe to events on the lines. - Release the requested lines. (Note: Specific member functions and their details are not provided in the source text and would typically be found in the full API documentation.) ``` -------------------------------- ### Get Info for All Lines on a GPIO Chip Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Retrieves detailed information for all GPIO lines on a specified gpiochip, including line number, name, direction, consumer, and active state. ```none $ gpioinfo -c 1 gpiochip1 - 8 lines: line 0: "BT_ON" output line 1: "WL_ON" output line 2: "PWR_LED_OFF" output active-low consumer="led1" line 3: "GLOBAL_RESET" output line 4: "VDD_SD_IO_SEL" output consumer="vdd-sd-io" line 5: "CAM_GPIO" output consumer="cam1_regulator" line 6: "SD_PWR_ON" output consumer="sd_vcc_reg" line 7: "SD_OC_N" input ``` -------------------------------- ### Run gpiod Python Bindings Tests Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/python/README.md Executes the test suite for the gpiod Python bindings. Requires running from the `libgpiod/bindings/python` directory as root. ```bash python -B -m tests ``` -------------------------------- ### Detect GPIO chips Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpiocli_top.rst Use 'gpiocli detect' to list available GPIO chips and their properties in the system. ```none $ gpiocli detect gpiochip0 [INT34C6:00] (463 lines) ``` -------------------------------- ### Set Multiple GPIO Values and Daemonize Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Sets the values for two GPIO lines, then daemonizes the process to continue holding the lines with their specified values. ```none $ gpioset --daemonize GPIO23=1 GPIO24=0 ``` -------------------------------- ### gpiod.LineSettings Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/python_line_settings.rst The `gpiod.LineSettings` class provides a way to define and manage the configuration of GPIO lines, including their direction, active level, debounce delay, and consumer name. ```APIDOC ## Class: gpiod.LineSettings ### Description Represents the settings for a GPIO line. This class allows for the configuration of various properties of a GPIO line, such as its direction (input/output), active level, debounce delay, and the name of the consumer. ### Attributes - **direction** (gpiod.LineDirection): The direction of the GPIO line. Can be `gpiod.LineDirection.CONSUMER` (input) or `gpiod.LineDirection.OUTPUT`. - **active_level** (gpiod.LineActiveLevel): The active level of the GPIO line. Can be `gpiod.LineActiveLevel.HIGH` or `gpiod.LineActiveLevel.LOW`. - **debounce_delay** (datetime.timedelta): The debounce delay for the GPIO line. If set, the kernel will only report changes to the line's value that persist for at least this duration. - **consumer** (str): The name of the consumer of the GPIO line. This is a string that identifies the entity using the GPIO line. ``` -------------------------------- ### Monitor Multiple Lines for First Request Event Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Monitor multiple GPIO lines for the 'requested' event using gpionotify. The tool exits quietly after the first request event is detected on any line. ```none $ gpionotify --quiet --num-events=1 --event=requested GPIO5 GPIO6 GPIO12 GPIO17 ``` -------------------------------- ### Monitor Multiple GPIO Lines for First Edge Event Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Monitor several GPIO lines simultaneously with gpiomon. The tool exits quietly after the first edge event is detected on any of the specified lines. ```none $ gpiomon --quiet --num-events=1 GPIO5 GPIO6 GPIO12 GPIO17 ``` -------------------------------- ### Detect Available GPIO Chips Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Lists all gpiochips present on the system, including their names, labels, and the number of GPIO lines they manage. ```none $ gpiodetect gpiochip0 [pinctrl-bcm2711] (58 lines) gpiochip1 [raspberrypi-exp-gpio] (8 lines) ``` -------------------------------- ### Reconfigure GPIO line for input with edge detection Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpiocli_top.rst Reconfigure a GPIO line to act as an input and enable edge detection for both rising and falling edges. ```none $ gpiocli reconfigure --input --both-edges request0 ``` -------------------------------- ### gpiod.LineInfo Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/python_line_info.rst The LineInfo class provides information about a GPIO line, such as its name, offset, and consumer. ```APIDOC ## gpiod.LineInfo ### Description Provides information about a GPIO line. ### Attributes - **name** (str): The name of the GPIO line, if available. - **consumer** (str): The name of the consumer using the GPIO line, if any. - **gpio** (int): The GPIO number of the line. - **offset** (int): The offset of the line within its chip. - **num_chips** (int): The number of GPIO chips available. - **num_lines** (int): The number of lines available on the chip. - **flags** (int): Flags indicating the line's capabilities (e.g., open-drain, active-low). - **used** (bool): True if the line is currently in use, False otherwise. ``` -------------------------------- ### List active GPIO requests Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpiocli_top.rst Use 'gpiocli requests' to view all currently active GPIO requests and the lines they control. ```none $ gpiocli requests request0 (gpiochip1) Offsets: [5] ``` -------------------------------- ### Set GPIO line value Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpiocli_top.rst Change the output value of a configured GPIO line. ```none $ gpiocli set foo=inactive ``` -------------------------------- ### Block Until GPIO Line is Released Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Use gpionotify in quiet mode to block until a specific GPIO line is released. This is useful for waiting for a resource to become available. ```none $ gpionotify --quiet --num-events=1 --event=released GPIO6 ``` -------------------------------- ### Monitor GPIO Line Info Changes Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Use gpionotify to track changes in the status of a GPIO line, such as when it is requested or released. Output includes timestamps and line status. ```none $ gpionotify GPIO23 11571.816473718 requested "GPIO23" 11571.816535124 released "GPIO23" 11572.722894029 requested "GPIO23" 11572.722932843 released "GPIO23" 11573.222998598 requested "GPIO23" ... ``` -------------------------------- ### gpiod::request_config Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/cpp_request_config.rst This section details the members of the gpiod::request_config class, which are used to configure GPIO requests. ```APIDOC ## gpiod::request_config ### Description This class provides configuration options for GPIO requests. ### Members This class has several members that can be configured. Please refer to the Doxygen documentation for a complete list of members and their descriptions. ``` -------------------------------- ### Monitor GPIO Events with Time and Unquoted Line Name Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Use gpiomon to wait for a specified number of edge events on a GPIO line. Supports local time and unquoted line names for output. ```none $ gpiomon --num-events=3 --edges=both --localtime --unquoted GPIO22 2022-11-15T10:36:59.109615508 rising GPIO22 2022-11-15T10:36:59.129681898 falling GPIO22 2022-11-15T10:36:59.698971886 rising GPIO22 ``` -------------------------------- ### Check GPIO Chip Device Existence Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/python/README.md Verifies if a specified GPIO chip character device file exists at the given path. ```python import gpiod gpiod.is_gpiochip_device("/dev/gpiochip0") ``` -------------------------------- ### gpiod::line::drive Enumeration Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/cpp_line.rst Defines the drive strength configuration for a GPIO line. ```APIDOC ## Enum: gpiod::line::drive ### Description Defines the drive strength configuration for a GPIO line, which can affect signal integrity and power consumption. ### Values (Details of enum values would be listed here if available in the source) ``` -------------------------------- ### gpiod.line.Drive Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/python_line.rst Represents the possible drive types for a GPIO line. ```APIDOC ## gpiod.line.Drive ### Description Enumeration for the possible drive types of a GPIO line. ### Members - **PUSH_PULL**: Push-pull drive. - **OPEN_DRAIN**: Open-drain drive. - **OPEN_SOURCE**: Open-source drive. ``` -------------------------------- ### Blink LED at 1Hz using gpioset Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Blinks an LED connected to GPIO22 at a frequency of 1Hz by setting the line high for 500ms and then low. ```none $ gpioset -t500ms GPIO22=1 ``` -------------------------------- ### Print GPIO Line Name Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/rust/libgpiod/README.md Opens a GPIO chip and retrieves the name of a specific GPIO line. Defaults to 'unnamed' if the name is not available. ```rust let chip = Chip::open(&Path::new("/dev/gpiochip0"))?; let info = chip.line_info(0)?; let name = info.name().unwrap_or("unnamed"); println!("{name}"); ``` -------------------------------- ### Override Build Flags for libgpiod Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/rust/libgpiod-sys/README.md Set environment variables to inform the build system about the location of libgpiod libraries and headers when pkg-config is not available or desired. This is useful for building against intermediate build results of the C library. ```shell export SYSTEM_DEPS_LIBGPIOD_NO_PKG_CONFIG=1 export SYSTEM_DEPS_LIBGPIOD_SEARCH_NATIVE="/lib/.libs/" export SYSTEM_DEPS_LIBGPIOD_LIB=gpiod export SYSTEM_DEPS_LIBGPIOD_INCLUDE="/include/" ``` -------------------------------- ### Toggle GPIO Line Output Value Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/rust/libgpiod/README.md Configures a GPIO line for output, sets its initial value, and then toggles it to the inactive state. Requires specifying the line offset and consumer name. ```rust let mut settings = line::Settings::new()?; settings .set_direction(line::Direction::Output)? .set_output_value(Value::Active)?; let mut line_cfg = line::Config::new()?; line_cfg.add_line_settings(&[line_offset], settings)?; let mut req_cfg = request::Config::new()?; req_cfg.set_consumer("toggle-line-value")?; let chip = Chip::open(&Path::new("/dev/gpiochip0"))?; /* Request with value 1 */ let mut req = chip.request_lines(Some(&req_cfg), &line_cfg)?; /* Toggle to value 0 */ req.set_value(line_offset, Value::InActive)?; ``` -------------------------------- ### Release GPIO request Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpiocli_top.rst Release a previously requested set of GPIO lines, freeing them up for other uses. ```none $ gpiocli release request0 ``` -------------------------------- ### Block Until GPIO Edge Event Occurs (Quiet Mode) Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Use gpiomon in quiet mode to block execution until a single edge event occurs on the specified GPIO line, without printing any output. ```none $ gpiomon --num-events=1 --quiet GPIO22 ``` -------------------------------- ### Monitor GPIO Requests with UTC Time and Unquoted Name Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Utilize gpionotify to monitor GPIO line requests, displaying timestamps in UTC and the line name without quotes. Exits after a specified number of events. ```none $ gpionotify --utc --unquoted GPIO23 2022-11-15T03:05:23.807090687Z requested GPIO23 2022-11-15T03:05:23.807151390Z released GPIO23 2022-11-15T03:05:24.784984280Z requested GPIO23 2022-11-15T03:05:24.785023873Z released GPIO23 ... ``` -------------------------------- ### Request GPIO lines Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpiocli_top.rst Request GPIO lines for output. The state is retained by the gpio-manager after gpiocli exits. The output is the name of the request. ```none $ gpiocli request --output foo=active request0 ``` -------------------------------- ### gpiod::api_version Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/cpp_misc.rst Retrieves the version of the libgpiod API. ```APIDOC ## Function: gpiod::api_version ### Description Retrieves the version of the libgpiod API. ### Signature unsigned int api_version(); ### Returns An unsigned integer representing the API version. ``` -------------------------------- ### gpiod::info_event Class Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/cpp_info_event.rst The gpiod::info_event class provides information about GPIO events. The members of this class are documented below. ```APIDOC ## Class: gpiod::info_event ### Description This class represents an event related to GPIO information. It contains members that provide details about the event. ### Members (Members are documented via doxygenclass directive, specific member details are not provided in the source text.) ``` -------------------------------- ### gpiod::request_builder Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/cpp_line_request.rst The `request_builder` class is used to construct requests for GPIO lines. It allows specifying configuration options before the request is finalized. ```APIDOC ## Class: gpiod::request_builder ### Description This class provides methods to build a request for GPIO lines. Users can configure various aspects of the request, such as the consumer name, line configuration, and desired flags, before creating the actual `line_request` object. ### Members (Details of members would be listed here if available in the source) ``` -------------------------------- ### Blink LED with 20% Duty Cycle Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Blinks an LED connected to GPIO22 with a 20% duty cycle by setting the line high for 200ms and low for 800ms. ```none $ gpioset -t200ms,800ms GPIO22=1 ``` -------------------------------- ### Set GPIO Line Value and Hold Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Sets the value of a specified GPIO line and holds that value until the process is terminated. ```none $ gpioset GPIO23=1 ``` -------------------------------- ### General Error Handling Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/core_api.rst All functions exported by libgpiod that can fail set errno upon failure. Functions returning an int return -1 on error, while functions returning a pointer indicate an error by returning a NULL pointer. ```APIDOC ## Error Handling All functions exported by libgpiod that can fail set ``errno`` to one of the error values defined in ``errno.h`` upon failure. The way of notifying the caller that an error occurred varies between functions, but in general a function that returns an ``int``, returns ``-1`` on error, while a function returning a pointer indicates an error condition by returning a **NULL pointer**. ``` -------------------------------- ### Read Multiple GPIO Line Values with Custom Options Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Reads the values of two GPIO lines, setting the active state to low and suppressing quoted names in the output. ```none $ gpioget --active-low --unquoted GPIO23 GPIO24 GPIO23=active GPIO24=active ``` -------------------------------- ### gpiod::bad_mapping Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/cpp_exceptions.rst This exception is thrown when there is an issue with the mapping of GPIO lines, such as an invalid configuration or an attempt to access non-existent lines. ```APIDOC ## Exception: gpiod::bad_mapping ### Description Indicates an error related to the configuration or access of GPIO line mappings. ### Usage Catch this exception to diagnose and report problems with GPIO line mapping configurations. ### Members (No specific members documented in the source) ``` -------------------------------- ### Developer's Certificate of Origin (DCO) Attestation Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/CONTRIBUTING.md Include this line at the end of your commit message to certify the origin and licensing rights of your contribution, following the DCO process. ```git Signed-off-by: Random J Developer ``` -------------------------------- ### gpiod::chip_info Members Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/cpp_chip_info.rst The gpiod::chip_info class provides access to various attributes of a GPIO chip. ```APIDOC ## gpiod::chip_info This class represents information about a GPIO chip. ### Members This class has the following members, which are accessible to users: - **name** (string): The name of the GPIO chip. - **label** (string): A human-readable label for the GPIO chip. - **num_lines** (unsigned int): The total number of GPIO lines available on the chip. ``` -------------------------------- ### Read GPIO Line Event Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/bindings/rust/libgpiod/README.md Configures a GPIO line for input with edge detection (both rising and falling) and continuously reads edge events. Events are printed to the console, showing the line offset and event type. ```rust let mut lsettings = line::Settings::new()?; lsettings .set_direction(line::Direction::Input)? .set_edge_detection(Some(line::Edge::Both))?; let mut line_cfg = line::Config::new()?; line_cfg.add_line_settings(&[line_offset], settings)?; let mut req_cfg = request::Config::new()?; req_cfg.set_consumer("toggle-line-value")?; let chip = Chip::open(&Path::new("/dev/gpiochip0"))?; let req = chip.request_lines(Some(&req_cfg), &line_cfg)?; let mut buffer = request::Buffer::new(1)?; loop { let events = req.read_edge_events(&mut buffer)?; for event in events { println!( "line: {} type: {}", event.line_offset(), match event.event_type()? { EdgeKind::Rising => "Rising", EdgeKind::Falling => "Falling", } ); } } ``` -------------------------------- ### gpiod.line.Clock Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/python_line.rst Represents the possible clock sources for a GPIO line. ```APIDOC ## gpiod.line.Clock ### Description Enumeration for the possible clock sources for a GPIO line. ### Members - **NONE**: No clock source. - **RISING**: Clock on rising edge. - **FALLING**: Clock on falling edge. ``` -------------------------------- ### Read GPIO Line Value as Numeric Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Reads the value of a single GPIO line and outputs it as a numeric value (1 for active, 0 for inactive), without quoting the line name. ```none $ gpioget --numeric RXD1 1 ``` -------------------------------- ### Set GPIO Value and Hold for Specific Period Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Sets the value of a single GPIO line, holds it for a specified duration (e.g., 20ms), and then exits. ```none $ gpioset --hold-period 20ms -t0 GPIO23=1 ``` -------------------------------- ### gpiod.InfoEvent Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/python_info_event.rst The InfoEvent class is used to represent information about GPIO events. It provides details about the event type and associated data. ```APIDOC ## Class: gpiod.InfoEvent ### Description Represents information about a GPIO event. ### Methods #### `__init__` Initializes an InfoEvent object. #### `event_type` Returns the type of the GPIO event. #### `data` Returns the data associated with the GPIO event. ``` -------------------------------- ### Monitor GPIO Rising Edge Events Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/gpio_tools.rst Waits for and reports a specified number of rising edge events on a single GPIO line, then exits. Includes timestamps and event type. ```none $ gpiomon --num-events=3 --edges=rising GPIO22 10002.907638045 rising "GPIO22" 10037.132562259 rising "GPIO22" 10047.179790748 rising "GPIO22" ``` -------------------------------- ### gpiod.request_lines Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/python_misc.rst Requests a set of GPIO lines from a GPIO chip. This function is a convenient way to acquire multiple lines at once. ```APIDOC ## gpiod.request_lines ### Description Requests a set of GPIO lines from a GPIO chip. This function is a convenient way to acquire multiple lines at once. ### Method N/A (Python function) ### Parameters None explicitly documented in this snippet. ### Response Returns a representation of the requested GPIO lines. ``` -------------------------------- ### gpiod::line_request Source: https://github.com/pub/scm/libs/libgpiod/libgpiod/blob/master/docs/cpp_line_request.rst The `line_request` class represents an active request for one or more GPIO lines. It provides methods to interact with the requested lines, such as reading their values or setting their configuration. ```APIDOC ## Class: gpiod::line_request ### Description This class represents a successfully acquired request for GPIO lines. It allows users to perform operations on the lines that have been requested, such as reading their state, writing to them, or releasing the request. ### Members (Details of members would be listed here if available in the source) ```