Private
Public Access
2
0

i2c.hpp: add I2c::writeReg method

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-06-24 14:40:34 +01:00
parent a5aeea4d04
commit 17edeb3e7a
2 changed files with 49 additions and 0 deletions

View File

@@ -108,6 +108,19 @@ class I2c {
maa_result_t write(const unsigned char* data, int length) {
return maa_i2c_write(m_i2c, data, length);
}
/**
* Write to an i2c register
*
* @param reg Register to write to
* @param data Value to write to register
* @return Result of operation
*/
maa_result_t writeReg(const unsigned char reg, const unsigned char data) {
const unsigned char buf[2] = {reg, data};
return maa_i2c_write(m_i2c, buf, 2);
}
/**
* Write multiple bytes to the bus
*