i2c2_device Class Reference

#include <i2c2_device.hpp>

Inheritance diagram for i2c2_device:

Protected Member Functions

 i2c2_device (uint8_t addr)
 Constructor of this base class that takes addr as a parameter. More...
 
uint8_t readReg (unsigned char reg)
 
void writeReg (unsigned char reg, unsigned char data)
 Writes a register of this device. More...
 
bool checkDeviceResponse ()
 
uint16_t get16BitRegister (unsigned char reg)
 

Detailed Description

I2C Device Base Class This class can be inherited by an I2C Device to be able to read and write registers more easily as this class will puts an abstraction layer on I2C and provides simple functionality to read and write registers over I2C Bus.

Constructor & Destructor Documentation

i2c2_device::i2c2_device ( uint8_t  addr)
inlineprotected

Constructor of this base class that takes addr as a parameter.

Member Function Documentation

bool i2c2_device::checkDeviceResponse ( )
inlineprotected
Returns
true if the device responds to its address
uint16_t i2c2_device::get16BitRegister ( unsigned char  reg)
inlineprotected

Reads 16-bit register from reg and reg+1 granted that reg has MSB

uint8_t i2c2_device::readReg ( unsigned char  reg)
inlineprotected
Returns
the register content of this device
void i2c2_device::writeReg ( unsigned char  reg,
unsigned char  data 
)
inlineprotected

Writes a register of this device.


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