danny hack
Diff: Lis2dh12.cpp
- Revision:
- 4:043396f22548
- Parent:
- 3:07ddb07f8b7f
- Child:
- 5:15d1c73137e8
--- a/Lis2dh12.cpp Fri Jan 12 16:10:28 2018 +0000 +++ b/Lis2dh12.cpp Wed Feb 28 19:59:37 2018 +0000 @@ -77,30 +77,30 @@ }while(!(tempData & 0x80)); // Same data have been overwritten + //i2c.readFromReg((char)OUT_X_H, &tempData, 1); + //rawData = (int8_t)tempData << 8; i2c.readFromReg((char)OUT_X_H, &tempData, 1); - rawData = (int8_t)tempData << 8; - i2c.readFromReg((char)OUT_X_L, &tempData, 1); - rawData |= (int8_t)tempData; + rawData = (int8_t)tempData; return rawData; } int16_t Lis2dh12::readYAxis(){ int16_t rawData; char tempData; + //i2c.readFromReg((char)OUT_Y_H, &tempData, 1); + //rawData = (int8_t)tempData << 8; i2c.readFromReg((char)OUT_Y_H, &tempData, 1); - rawData = (int8_t)tempData << 8; - i2c.readFromReg((char)OUT_Y_L, &tempData, 1); - rawData |= (int8_t)tempData; + rawData = (int8_t)tempData; return rawData; } int16_t Lis2dh12::readZAxis(){ - int16_t rawData; + int16_t rawData = 0; char tempData; + //i2c.readFromReg((char)OUT_Z_H, &tempData, 1); + //rawData = (int8_t)tempData << 8; i2c.readFromReg((char)OUT_Z_H, &tempData, 1); - rawData = (int8_t)tempData << 8; - i2c.readFromReg((char)OUT_Z_L, &tempData, 1); - rawData |= (int8_t)tempData; + rawData = (int8_t)tempData; return rawData; }