trikRuntime
trikControl::I2cCommunicator Class Reference

Implementation of i2c communicator. More...

#include <i2cCommunicator.h>

Inheritance diagram for trikControl::I2cCommunicator:
Collaboration diagram for trikControl::I2cCommunicator:

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...
 

Detailed Description

Implementation of i2c communicator.

Constructor & Destructor Documentation

I2cCommunicator::I2cCommunicator ( const trikKernel::Configurer configurer,
trikHal::MspI2cInterface i2c,
uint8_t  bus,
uint8_t  deviceId 
)

Constructor.

Parameters
i2c- hardware abstraction.
bus- device bus (1 or 2)
deviceId- device address on bus.
I2cCommunicator::~I2cCommunicator ( )

Member Function Documentation

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.

DeviceInterface::Status I2cCommunicator::status ( ) const
overridevirtual

Returns current status of the device.

Implements trikControl::DeviceInterface.


The documentation for this class was generated from the following files: