Treehopper C++ API
I2c Class Referenceabstract

Base I2c interface.

#include <I2c.h>

Inheritance diagram for I2c:
HardwareI2c

Public Member Functions

virtual ~I2c ()
 
virtual void speed (double value)=0
 Set the speed, in kHz, to use. More...
 
virtual double speed ()=0
 Gets the current speed, in kHz. More...
 
virtual void enabled (bool value)=0
 Sets whether the module is enabled. More...
 
virtual bool enabled ()=0
 Gets whether the module is enabled. More...
 
virtual std::vector< uint8_t > sendReceive (uint8_t address, std::vector< uint8_t > data, size_t numBytesToRead=0)=0
 Send and/or receive data with the i2c module. More...
 

Constructor & Destructor Documentation

◆ ~I2c()

virtual ~I2c ( )
inlinevirtual

Member Function Documentation

◆ enabled() [1/2]

virtual void enabled ( bool  value)
pure virtual

Implemented in HardwareI2c.

◆ enabled() [2/2]

virtual bool enabled ( )
pure virtual

Implemented in HardwareI2c.

◆ sendReceive()

virtual std::vector<uint8_t> sendReceive ( uint8_t  address,
std::vector< uint8_t >  data,
size_t  numBytesToRead = 0 
)
pure virtual
Parameters
[in]addressthe address of the slave i2c board you wish to communicate with
[in]dataa vector containing the bytes to write
[in]numBytesToReadthe number of bytes to read from the board
Returns
the read data, or nullptr.

Implemented in HardwareI2c.

◆ speed() [1/2]

virtual void speed ( double  value)
pure virtual

Implemented in HardwareI2c.

◆ speed() [2/2]

virtual double speed ( )
pure virtual

Implemented in HardwareI2c.


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