![]() |
PIDUINO
|
Represents a GPIO chip and provides methods to interact with it. More...
#include <gpio2.h>
Public Member Functions | |
Chip (const std::string &consumer=std::string()) | |
Constructor for the Chip class. | |
~Chip () | |
Destructor for the Chip class. | |
std::string | consumer () const |
Gets the consumer label of the GPIO chip. | |
template<class ParamType > | |
bool | ioCtl (unsigned long cmd, ParamType *param) |
Performs an IOCTL operation on the GPIO chip. | |
int | errorCode () const |
Gets the last error code from the IOCTL operation. | |
int | result () const |
Gets the result of the last IOCTL operation. | |
const char * | errorMessage () const |
Gets the error message corresponding to the last error code. | |
bool | open (const char *dev) |
Opens the GPIO chip device. | |
bool | open (const std::string &dev) |
Opens the GPIO chip device using a string. | |
bool | open (uint32_t chip_no) |
Opens the GPIO chip device using a chip number. | |
bool | isOpen () const |
Checks if the GPIO chip device is open. | |
std::string | dev () const |
Gets the path to the GPIO chip device. | |
bool | close () |
Closes the GPIO chip device. | |
bool | fillInfo () |
Fills the chip information structure with data from the device. | |
std::string | name () const |
Gets the name of the GPIO chip. | |
std::string | label () const |
Gets the label of the GPIO chip. | |
uint32_t | lines () const |
Gets the number of lines available on the GPIO chip. | |
bool | lineInfo (uint32_t offset, LineInfo *info) |
Retrieves information about a specific GPIO line. | |
Static Public Member Functions | |
static std::string | devPath (uint32_t chip_no) |
Gets the path to a GPIO chip device based on its chip number. | |
Private Attributes | |
std::string | m_dev |
std::string | m_consumer |
ChipInfo | m_dev_info |
int | m_fd |
int | m_last_error |
int | m_last_result |
Represents a GPIO chip and provides methods to interact with it.
This class encapsulates the functionality to open, close, and query information about a GPIO chip, as well as perform IOCTL operations.
|
inline |
|
inline |
|
inline |
Closes the GPIO chip device.
Definition at line 681 of file gpio2.h.
References close(), isOpen(), m_fd, m_last_error, and m_last_result.
Referenced by close(), and ~Chip().
|
inline |
Gets the consumer label of the GPIO chip.
Definition at line 569 of file gpio2.h.
References m_consumer.
|
inline |
|
inlinestatic |
|
inline |
Gets the last error code from the IOCTL operation.
Definition at line 597 of file gpio2.h.
References m_last_error.
Referenced by errorMessage().
|
inline |
Gets the error message corresponding to the last error code.
Definition at line 615 of file gpio2.h.
References errorCode().
|
inline |
Fills the chip information structure with data from the device.
Definition at line 702 of file gpio2.h.
References ioCtl(), isOpen(), and m_dev_info.
|
inline |
Performs an IOCTL operation on the GPIO chip.
ParamType | The type of the parameter for the IOCTL operation. |
cmd | The IOCTL command. |
param | A pointer to the parameter for the IOCTL operation. |
Definition at line 581 of file gpio2.h.
References m_fd, m_last_error, and m_last_result.
Referenced by fillInfo(), and lineInfo().
|
inline |
|
inline |
Gets the label of the GPIO chip.
Definition at line 724 of file gpio2.h.
References m_dev_info.
|
inline |
Retrieves information about a specific GPIO line.
offset | The offset of the GPIO line. |
info | A pointer to a LineInfo structure to be filled with line information. |
Definition at line 744 of file gpio2.h.
References ioCtl().
|
inline |
Gets the number of lines available on the GPIO chip.
Definition at line 733 of file gpio2.h.
References m_dev_info.
|
inline |
Gets the name of the GPIO chip.
Definition at line 715 of file gpio2.h.
References m_dev_info.
|
inline |
Opens the GPIO chip device.
dev | The path to the GPIO chip device. |
Definition at line 625 of file gpio2.h.
References dev(), isOpen(), m_dev, m_fd, m_last_error, and open().
Referenced by open(), open(), and open().
|
inline |
|
inline |
|
inline |
Gets the result of the last IOCTL operation.
Definition at line 606 of file gpio2.h.
References m_last_result.
|
private |
Definition at line 764 of file gpio2.h.
Referenced by consumer().
|
private |
|
private |
|
private |
|
private |