libgpiod
1.6.2
|
Represents a GPIO chip. More...
#include <gpiod.hpp>
Public Types | |
enum | : int { OPEN_LOOKUP = 1, OPEN_BY_PATH, OPEN_BY_NAME, OPEN_BY_LABEL, OPEN_BY_NUMBER } |
Affect the way in which chip::chip and chip::open will try to open a GPIO chip character device. More... | |
Public Member Functions | |
GPIOD_API | chip (void)=default |
Default constructor. More... | |
GPIOD_API | chip (const ::std::string &device, int how=OPEN_LOOKUP) |
Constructor. More... | |
GPIOD_API | chip (const chip &other)=default |
Copy constructor. More... | |
GPIOD_API | chip (chip &&other)=default |
Move constructor. More... | |
GPIOD_API chip & | operator= (const chip &other)=default |
Assignment operator. More... | |
GPIOD_API chip & | operator= (chip &&other)=default |
Move assignment operator. More... | |
GPIOD_API | ~chip (void)=default |
Destructor. More... | |
GPIOD_API void | open (const ::std::string &device, int how=OPEN_LOOKUP) |
Open a GPIO chip. More... | |
GPIOD_API void | reset (void) noexcept |
Reset the internal smart pointer owned by this object. | |
GPIOD_API ::std::string | name (void) const |
Return the name of the chip held by this object. More... | |
GPIOD_API ::std::string | label (void) const |
Return the label of the chip held by this object. More... | |
GPIOD_API unsigned int | num_lines (void) const |
Return the number of lines exposed by this chip. More... | |
GPIOD_API line | get_line (unsigned int offset) const |
Get the line exposed by this chip at given offset. More... | |
GPIOD_API line | find_line (const ::std::string &name) const |
Get the line exposed by this chip by name. More... | |
GPIOD_API line_bulk | get_lines (const ::std::vector< unsigned int > &offsets) const |
Get a set of lines exposed by this chip at given offsets. More... | |
GPIOD_API line_bulk | get_all_lines (void) const |
Get all lines exposed by this chip. More... | |
GPIOD_API line_bulk | find_lines (const ::std::vector<::std::string > &names) const |
Get a set of lines exposed by this chip by their names. More... | |
GPIOD_API bool | operator== (const chip &rhs) const noexcept |
Equality operator. More... | |
GPIOD_API bool | operator!= (const chip &rhs) const noexcept |
Inequality operator. More... | |
GPIOD_API | operator bool (void) const noexcept |
Check if this object holds a reference to a GPIO chip. More... | |
GPIOD_API bool | operator! (void) const noexcept |
Check if this object doesn't hold a reference to a GPIO chip. More... | |
Represents a GPIO chip.
Internally this class holds a smart pointer to an open GPIO chip descriptor. Multiple objects of this class can reference the same chip. The chip is closed and all resources freed when the last reference is dropped.
anonymous enum : int |
Affect the way in which chip::chip and chip::open will try to open a GPIO chip character device.
|
default |
Default constructor.
Creates an empty GPIO chip object.
GPIOD_API gpiod::chip::chip | ( | const ::std::string & | device, |
int | how = OPEN_LOOKUP |
||
) |
Constructor.
Opens the chip using chip::open.
device | String describing the GPIO chip. |
how | Indicates how the chip should be opened. |
Copy constructor.
References the object held by other.
other | Other chip object. |
Move constructor.
References the object held by other.
other | Other chip object. |
|
default |
Destructor.
Unreferences the internal chip object.
Get the line exposed by this chip by name.
name | Line name. |
Get a set of lines exposed by this chip by their names.
names | Vector of line names. |
Get all lines exposed by this chip.
Get the line exposed by this chip at given offset.
offset | Offset of the line. |
Get a set of lines exposed by this chip at given offsets.
offsets | Vector of line offsets. |
GPIOD_API ::std::string gpiod::chip::label | ( | void | ) | const |
Return the label of the chip held by this object.
GPIOD_API ::std::string gpiod::chip::name | ( | void | ) | const |
Return the name of the chip held by this object.
GPIOD_API unsigned int gpiod::chip::num_lines | ( | void | ) | const |
Return the number of lines exposed by this chip.
GPIOD_API void gpiod::chip::open | ( | const ::std::string & | device, |
int | how = OPEN_LOOKUP |
||
) |
Open a GPIO chip.
device | String describing the GPIO chip. |
how | Indicates how the chip should be opened. |
If the object already holds a reference to an open chip, it will be closed and the reference reset.
|
explicitnoexcept |
Check if this object holds a reference to a GPIO chip.
|
noexcept |
Check if this object doesn't hold a reference to a GPIO chip.
References OPEN_BY_LABEL, OPEN_BY_NAME, OPEN_BY_NUMBER, OPEN_BY_PATH, and OPEN_LOOKUP.
|
noexcept |
Inequality operator.
rhs | Right-hand side of the equation. |
Move assignment operator.
References the object held by other.
other | Other chip object. |
Assignment operator.
References the object held by other.
other | Other chip object. |
Equality operator.
rhs | Right-hand side of the equation. |