Represents a GPIO chip.
More...
#include <chip.hpp>
Represents a GPIO chip.
Definition at line 41 of file chip.hpp.
◆ chip() [1/2]
gpiod::chip::chip |
( |
const ::std::filesystem::path & |
path | ) |
|
|
explicit |
Instantiates a new chip object by opening the device file indicated by the path
argument.
- Parameters
-
path | Path to the device file to open. |
◆ chip() [2/2]
gpiod::chip::chip |
( |
chip && |
other | ) |
|
|
noexcept |
Move constructor.
- Parameters
-
◆ close()
void gpiod::chip::close |
( |
| ) |
|
Close the GPIO chip device file and free associated resources.
- Note
- The chip object can live after calling this method but any of the chip's mutators will throw a logic_error exception.
◆ fd()
int gpiod::chip::fd |
( |
| ) |
const |
Get the file descriptor associated with this chip.
- Returns
- File descriptor number.
◆ get_info()
Get information about the chip.
- Returns
- New chip_info object.
◆ get_line_info()
Retrieve the current snapshot of line information for a single line.
- Parameters
-
offset | Offset of the line to get the info for. |
- Returns
- New gpiod::line_info object.
◆ get_line_offset_from_name()
int gpiod::chip::get_line_offset_from_name |
( |
const ::std::string & |
name | ) |
const |
Map a GPIO line's name to its offset within the chip.
- Parameters
-
name | Name of the GPIO line to map. |
- Returns
- Offset of the line within the chip or -1 if the line with given name is not exposed by this chip.
◆ operator bool()
gpiod::chip::operator bool |
( |
| ) |
const |
|
explicitnoexcept |
Check if this object is valid.
- Returns
- True if this object's methods can be used, false otherwise. False usually means the chip was closed. If the user calls any of the methods of this class on an object for which this operator returned false, a logic_error will be thrown.
◆ operator=()
chip& gpiod::chip::operator= |
( |
chip && |
other | ) |
|
|
noexcept |
Move assignment operator.
- Parameters
-
- Returns
- Reference to self.
◆ path()
::std::filesystem::path gpiod::chip::path |
( |
| ) |
const |
Get the filesystem path that was used to open this GPIO chip.
- Returns
- Path to the underlying character device file.
◆ prepare_request()
◆ read_info_event()
Read a single line status change event from this chip.
- Returns
- New info_event object.
◆ unwatch_line_info()
void gpiod::chip::unwatch_line_info |
( |
line::offset |
offset | ) |
const |
Stop watching the line at given offset for info events.
- Parameters
-
offset | Offset of the line to get the info for. |
◆ wait_info_event()
bool gpiod::chip::wait_info_event |
( |
const ::std::chrono::nanoseconds & |
timeout | ) |
const |
Wait for line status events on any of the watched lines exposed by this chip.
- Parameters
-
timeout | Wait time limit in nanoseconds. |
- Returns
- True if at least one event is ready to be read. False if the wait timed out.
◆ watch_line_info()
The documentation for this class was generated from the following file: