Make all accelerometers I2C bus aware

Update accelerometers_common.h
This commit is contained in:
Ben V. Brown
2023-07-22 18:18:07 +10:00
parent 964d37a8e8
commit 1396363eaa
7 changed files with 47 additions and 39 deletions

View File

@@ -9,6 +9,7 @@
#define CORE_DRIVERS_BMA223_HPP_
#include "BMA223_defines.h"
#include "BSP.h"
#include "accelerometers_common.h"
#include "I2C_Wrapper.hpp"
class BMA223 {
@@ -17,7 +18,7 @@ public:
static bool initalize();
// 1 = rh, 2,=lh, 8=flat
static Orientation getOrientation() {
uint8_t val = FRToSI2C::I2C_RegisterRead(BMA223_ADDRESS, BMA223_INT_STATUS_3);
uint8_t val = ACCEL_I2C_CLASS::I2C_RegisterRead(BMA223_ADDRESS, BMA223_INT_STATUS_3);
val >>= 4; // we dont need high values
val &= 0b11;
if (val & 0b10) {