diff --git a/workspace/TS100/Core/Drivers/SC7A20.hpp b/workspace/TS100/Core/Drivers/SC7A20.hpp index 501b7260..a9d5ab80 100644 --- a/workspace/TS100/Core/Drivers/SC7A20.hpp +++ b/workspace/TS100/Core/Drivers/SC7A20.hpp @@ -17,9 +17,18 @@ public: static bool initalize(); //1 = rh, 2,=lh, 8=flat static Orientation getOrientation() { - return static_cast((FRToSI2C::I2C_RegisterRead(SC7A20_ADDRESS,SC7A20_INT2_SOURCE) >> 2) - 1); + uint8_t val = ((FRToSI2C::I2C_RegisterRead(SC7A20_ADDRESS, SC7A20_INT2_SOURCE) >> 2) - 1); + if (val == 8) + val = 3; + else if (val == 1) + val = 1; + else if (val == 2) + val = 0; + else + val = 3; + return static_cast(val); } - static void getAxisReadings(int16_t& x, int16_t& y, int16_t& z); + static void getAxisReadings(int16_t &x, int16_t &y, int16_t &z); private: };