i2c: add api call to read byte from a specified register
Signed-off-by: Anton Krasovsky <anton@no-mad.net> Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
committed by
Thomas Ingleby
parent
c852685975
commit
cbf4c7447f
@@ -143,6 +143,18 @@ class I2c {
|
||||
return mraa_i2c_write(m_i2c, buf, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read an i2c register
|
||||
*
|
||||
* @param reg Register to read from
|
||||
|
||||
* @return char read from the bus
|
||||
* @return char read from register
|
||||
*/
|
||||
int readReg(char reg) {
|
||||
return mraa_i2c_read_byte_data(m_i2c, reg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write multiple bytes to the bus
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user