Signed-off-by: Anton Krasovsky <anton@no-mad.net>
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
uint8_t mraa_i2c_read_byte(mraa_i2c_context dev);
/**
+ * Read a single byte from i2c context, from designated register
+ *
+ * @param dev The i2c context
+ * @param command The register
+ * @return The result of the read or -1 if failed
+ */
+uint8_t mraa_i2c_read_byte_data(mraa_i2c_context dev, uint8_t command);
+
+/**
* Write to an i2c context
*
* @param dev The i2c context
}
/**
+ * 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
*
* @param data The byte to send on the bus
return byte;
}
+uint8_t
+mraa_i2c_read_byte_data(mraa_i2c_context dev, uint8_t command)
+{
+ uint8_t byte = i2c_smbus_read_byte_data(dev->fh, command);
+ return byte;
+}
+
mraa_result_t
mraa_i2c_write(mraa_i2c_context dev, const uint8_t* data, int length)
{