Treehopper C++ API
SMBusDevice Class Reference

#include <SMBusDevice.h>

Public Member Functions

 SMBusDevice (uint8_t address, I2c &i2cModule, int rateKHz=100)
 
 ~SMBusDevice ()
 
uint8_t readByte ()
 Read a byte from the device. More...
 
void writeByte (uint8_t data)
 Write a byte to the device. More...
 
void writeData (std::vector< uint8_t > data)
 Write a vector of bytes. More...
 
std::vector< uint8_t > readData (size_t count)
 Read the specified number of bytes. More...
 
uint8_t readByteData (uint8_t reg)
 Read the specified 8-bit register. More...
 
uint16_t readWordData (uint8_t reg)
 Read the specified little-endian 16-bit register. More...
 
uint16_t readWordDataBE (uint8_t reg)
 Read the specified big-endian 16-bit register. More...
 
uint16_t readWord ()
 Read a 16-bit little-endian word from the device. More...
 
uint16_t readWordBE ()
 Read a 16-bit big-endian word from the device. More...
 
void writeByteData (uint8_t reg, uint8_t data)
 Write a byte to the specified register. More...
 
void writeWordData (uint8_t reg, uint16_t data)
 Write a 16-bit little-endian word to the specified register. More...
 
void writeWordDataBE (uint8_t reg, uint16_t data)
 Write a 16-bit big-endian word to the specified register. More...
 
std::vector< uint8_t > readBufferData (uint8_t reg, size_t count)
 Read a buffer of data starting at the specified register. More...
 
void writeBufferData (uint8_t reg, std::vector< uint8_t > data)
 Write a buffer of data to the specified register. More...
 

Constructor & Destructor Documentation

◆ SMBusDevice()

SMBusDevice ( uint8_t  address,
I2c i2cModule,
int  rateKHz = 100 
)

◆ ~SMBusDevice()

Member Function Documentation

◆ readBufferData()

std::vector<uint8_t> readBufferData ( uint8_t  reg,
size_t  count 
)
Parameters
regthe register to start reading from
countthe number of bytes to read
Returns
a vector of bytes read from the device

◆ readByte()

uint8_t readByte ( )
Returns
the byte read

◆ readByteData()

uint8_t readByteData ( uint8_t  reg)
Parameters
regthe register to read
Returns
the byte read

◆ readData()

std::vector<uint8_t> readData ( size_t  count)
Parameters
countthe number of bytes to read
Returns
a vector of bytes

◆ readWord()

uint16_t readWord ( )
Returns
the 16-bit little-endian word read

◆ readWordBE()

uint16_t readWordBE ( )
Returns
the 16-bit big-endian word read

◆ readWordData()

uint16_t readWordData ( uint8_t  reg)
Parameters
regthe address of the register
Returns
the 16-bit little-endian word read

◆ readWordDataBE()

uint16_t readWordDataBE ( uint8_t  reg)
Parameters
regthe address of the register
Returns
the 16-bit big-endian word read

◆ writeBufferData()

void writeBufferData ( uint8_t  reg,
std::vector< uint8_t >  data 
)
Parameters
regthe register to start writing to
dataa vector of bytes to write to the device

◆ writeByte()

void writeByte ( uint8_t  data)
Parameters
datathe byte to write

◆ writeByteData()

void writeByteData ( uint8_t  reg,
uint8_t  data 
)
Parameters
regthe register to write
datathe data to write

◆ writeData()

void writeData ( std::vector< uint8_t >  data)
Parameters
datathe data to write

◆ writeWordData()

void writeWordData ( uint8_t  reg,
uint16_t  data 
)
Parameters
regthe register to write
datathe 16-bit little-endian word to write

◆ writeWordDataBE()

void writeWordDataBE ( uint8_t  reg,
uint16_t  data 
)
Parameters
regthe register to write
datathe 16-bit big-endian word to write

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