![]() |
PIDUINO
|
Information class for I2C bus configuration and management. More...
#include <i2cdev.h>
Public Member Functions | |
Info (int id=0) | |
Constructs an Info object with the specified bus ID. | |
int | id () const |
Gets the current I2C bus ID. | |
void | setId (int id) |
Sets the I2C bus ID and updates the corresponding device path. | |
const std::string & | path () const |
Gets the device path for this I2C bus. | |
bool | setPath (const std::string &path) |
Sets the device path and extracts the corresponding bus ID. | |
bool | exists () const |
Checks if the I2C bus device file exists on the system. | |
bool | operator== (const Info &other) |
Equality comparison operator. | |
bool | operator!= (const Info &other) |
Inequality comparison operator. | |
Static Public Member Functions | |
static std::string | busPath (int id) |
Generates the device path for a given I2C bus ID. | |
static Info | defaultBus () |
Gets information about the default I2C bus on the system. | |
static std::deque< Info > | availableBuses () |
Returns a list of available I2C buses on the system. | |
Static Public Attributes | |
static const int | MaxBuses = 32 |
Maximum number of I2C buses supported by the system. | |
Private Attributes | |
int | _id |
The I2C bus ID. | |
std::string | _path |
The device path (e.g., "/dev/i2c-0") | |
Information class for I2C bus configuration and management.
This nested class encapsulates I2C bus information including bus ID, device path, and provides utility methods for bus discovery and validation.
Piduino::I2cDev::Info::Info | ( | int | id = 0 | ) |
Constructs an Info object with the specified bus ID.
id | The I2C bus ID (default: 0) |
|
static |
Returns a list of available I2C buses on the system.
|
static |
Generates the device path for a given I2C bus ID.
id | The bus ID |
|
static |
Gets information about the default I2C bus on the system.
|
inline |
Checks if the I2C bus device file exists on the system.
|
inline |
Gets the current I2C bus ID.
bool Piduino::I2cDev::Info::operator!= | ( | const Info & | other | ) |
Inequality comparison operator.
other | The Info object to compare with |
bool Piduino::I2cDev::Info::operator== | ( | const Info & | other | ) |
Equality comparison operator.
other | The Info object to compare with |
|
inline |
Gets the device path for this I2C bus.
|
inline |
Sets the I2C bus ID and updates the corresponding device path.
id | The new bus ID to set |
bool Piduino::I2cDev::Info::setPath | ( | const std::string & | path | ) |
Sets the device path and extracts the corresponding bus ID.
path | The device path to set |
|
private |