common.hpp: add C++ bindings for i2c bus number functions
authorBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 25 Aug 2015 10:36:05 +0000 (11:36 +0100)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 25 Aug 2015 10:36:14 +0000 (11:36 +0100)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
api/mraa/common.hpp

index 8b5f624..94821e8 100644 (file)
@@ -165,6 +165,30 @@ getPinCount()
 }
 
 /**
+ * Get platform usable I2C bus count, board must be initialised.
+ *
+ * @return number f usable I2C bus count on the current platform. Function will
+ * return -1 on failure
+ */
+inline int
+getI2cBusCount()
+{
+    return mraa_get_i2c_bus_count();
+}
+
+/**
+ * Get I2C adapter number in sysfs.
+ *
+ * @param i2c_bus the logical I2C bus number
+ * @return I2C adapter number in sysfs. Function will return -1 on failure
+ */
+inline int
+getI2cBusId(unsigned int i2c_bus)
+{
+    return mraa_get_i2c_bus_id(i2c_bus);
+}
+
+/**
 * Get name of pin, board must be initialised.
 *
 * @param pin number