summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantin Musca <constantin.musca@intel.com>2016-01-14 02:04:56 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-01-14 02:04:56 +0000
commit4a3a6ab493ede8855926fbfae4461b1b7fa5e4a3 (patch)
tree3117112d92f9b466215b6dca5da8aa3e186a547d
parent2ddefc6d5c7354839e2085767df8e27f50b587c0 (diff)
parentff4b53d72766ac6a0d38acbe114ebc5170324c3e (diff)
downloadintel-4a3a6ab493ede8855926fbfae4461b1b7fa5e4a3.tar.gz
sensors: SensorUtils: use mraa to get default i2c bus
am: ff4b53d727 * commit 'ff4b53d72766ac6a0d38acbe114ebc5170324c3e': sensors: SensorUtils: use mraa to get default i2c bus
-rw-r--r--peripheral/sensors/edison_arduino/SensorUtils.cpp30
-rw-r--r--peripheral/sensors/edison_arduino/SensorUtils.hpp11
2 files changed, 2 insertions, 39 deletions
diff --git a/peripheral/sensors/edison_arduino/SensorUtils.cpp b/peripheral/sensors/edison_arduino/SensorUtils.cpp
index 43a832b..662321e 100644
--- a/peripheral/sensors/edison_arduino/SensorUtils.cpp
+++ b/peripheral/sensors/edison_arduino/SensorUtils.cpp
@@ -17,34 +17,6 @@
#include <mraa.hpp>
#include "SensorUtils.hpp"
-const int kTriStateAllGpioPin = 214;
-const int kArduinoI2cBusNumber = 6;
-const int kNonArduinoI2cBusNumber = 1;
-
-bool SensorUtils::initialized = false;
-int SensorUtils::i2cBusNumber = -1;
-
int SensorUtils::getI2cBusNumber() {
- init();
-
- return i2cBusNumber;
-}
-
-void SensorUtils::init() {
- if (!SensorUtils::initialized) {
- mraa::Gpio *gpio = nullptr;
-
- try {
- gpio = new mraa::Gpio(kTriStateAllGpioPin, true, true);
- } catch(...) {}
-
- if (gpio == nullptr) {
- i2cBusNumber = kNonArduinoI2cBusNumber;
- } else {
- delete gpio;
- i2cBusNumber = kArduinoI2cBusNumber;
- }
-
- SensorUtils::initialized = true;
- }
+ return mraa_get_default_i2c_bus(MRAA_MAIN_PLATFORM_OFFSET);
}
diff --git a/peripheral/sensors/edison_arduino/SensorUtils.hpp b/peripheral/sensors/edison_arduino/SensorUtils.hpp
index 96c835f..dcd48bb 100644
--- a/peripheral/sensors/edison_arduino/SensorUtils.hpp
+++ b/peripheral/sensors/edison_arduino/SensorUtils.hpp
@@ -18,7 +18,7 @@
#define SENSOR_UTILS_HPP
/**
- * Instantiable factory design pattern class for sensor utils
+ * Sensor utils class
*
* It supports retrieving the i2c sensors bus number
*/
@@ -29,15 +29,6 @@ class SensorUtils {
* @return i2c bus number
*/
static int getI2cBusNumber();
-
- private:
- /*
- * Initialize static members
- */
- static void init();
-
- static bool initialized;
- static int i2cBusNumber;
};
#endif // SENSOR_UTILS_HPP