trikRuntime
|
Implementation of i2c communicator. More...
#include <i2cCommunicator.h>
Public Member Functions | |
I2cCommunicator (const trikKernel::Configurer &configurer, trikHal::MspI2cInterface &i2c, uint8_t bus, uint8_t deviceId) | |
Constructor. More... | |
~I2cCommunicator () | |
void | send (const QByteArray &data) |
Send data to current device, if it is connected. More... | |
int | read (const QByteArray &data) |
Reads data by given I2C command number and returns the result. More... | |
Status | status () const override |
Returns current status of the device. More... | |
Public Member Functions inherited from trikControl::DeviceInterface | |
DeviceInterface ()=default | |
virtual | ~DeviceInterface ()=default |
Additional Inherited Members | |
Public Types inherited from trikControl::DeviceInterface | |
enum | Status { Status::permanentFailure, Status::temporaryFailure, Status::off, Status::starting, Status::ready, Status::stopping } |
Device status. More... | |
Static Public Member Functions inherited from trikControl::DeviceInterface | |
static Status | combine (const DeviceInterface &underlying, const DeviceInterface::Status &dependent) |
Helper method to return status of a device relying on other device to work. More... | |
Implementation of i2c communicator.
I2cCommunicator::I2cCommunicator | ( | const trikKernel::Configurer & | configurer, |
trikHal::MspI2cInterface & | i2c, | ||
uint8_t | bus, | ||
uint8_t | deviceId | ||
) |
Constructor.
i2c | - hardware abstraction. |
bus | - device bus (1 or 2) |
deviceId | - device address on bus. |
I2cCommunicator::~I2cCommunicator | ( | ) |
int I2cCommunicator::read | ( | const QByteArray & | data | ) |
Reads data by given I2C command number and returns the result.
void I2cCommunicator::send | ( | const QByteArray & | data | ) |
Send data to current device, if it is connected.
|
overridevirtual |
Returns current status of the device.
Implements trikControl::DeviceInterface.