9#include <wiringPiI2C.h>
20RpiI2C::RpiI2C(
int deviceId): mDeviceId(deviceId)
24 mFileHandler = wiringPiI2CSetup(deviceId);
31 if (mFileHandler != 0)
41 if (mFileHandler != 0)
43 return wiringPiI2CRead(mFileHandler);
49void RpiI2C::Write(
int value)
52 if (mFileHandler != 0)
54 wiringPiI2CWrite(mFileHandler, value);
59void RpiI2C::WriteReg8(
int reg,
int value)
62 if (mFileHandler != 0)
64 wiringPiI2CWriteReg8(mFileHandler, reg, value);
69int RpiI2C::ReadReg8(
int reg)
72 if (mFileHandler != 0)
74 return wiringPiI2CReadReg8(mFileHandler, reg);
80void RpiI2C::WriteReg16(
int reg,
int value)
83 if (mFileHandler != 0)
85 wiringPiI2CWriteReg16(mFileHandler, reg, value);
90int RpiI2C::ReadReg16(
int reg)
93 if (mFileHandler != 0)
95 return wiringPiI2CReadReg16(mFileHandler, reg);