Code to get all the data through serial port
Dependents: payload_sensor payload_sensor
Diff: FXAS21002.cpp
- Revision:
- 2:1d1cd08b674d
- Parent:
- 1:8461f7fe0a7f
diff -r 8461f7fe0a7f -r 1d1cd08b674d FXAS21002.cpp --- a/FXAS21002.cpp Fri Jul 29 08:22:44 2016 +0000 +++ b/FXAS21002.cpp Fri Jul 30 11:11:34 2021 +0000 @@ -28,6 +28,8 @@ FXAS21002::FXAS21002(PinName sda, PinName scl, int addr) : m_i2c(sda, scl), m_addr(addr<<1) { // activate the peripheral + FXAS21002::activate(1); + FXAS21002::ready(1); } FXAS21002::~FXAS21002() { } @@ -46,6 +48,7 @@ readRegs(REG_OUT_X_MSB, &data[0], 1) ; readRegs(REG_OUT_X_LSB, &data[1], 1) ; value = (data[0] << 8) | data[1] ; +// printf("X: %d,%d, %d\t", data[0], data[1], value); return(value) ; } @@ -56,6 +59,7 @@ readRegs(REG_OUT_Y_MSB, &data[0], 1) ; readRegs(REG_OUT_Y_LSB, &data[1], 1) ; value = (data[0] << 8) | data[1] ; +// printf("Y: %d,%d, %d\t", data[0], data[1], value); return(value) ; } @@ -66,6 +70,7 @@ readRegs(REG_OUT_Z_MSB, &data[0], 1) ; readRegs(REG_OUT_Z_LSB, &data[1], 1) ; value = (data[0] << 8) | data[1] ; +// printf("Z: %d,%d, %d\t", data[0], data[1], value); return(value) ; }