Skip to content

Commit 87d3df1

Browse files
Updated indices for wakeup and read - ready for code review
Updated the indices to actually read the entire length of the 16-bits. Code is now ready for review.
1 parent c6638ff commit 87d3df1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/SparkFun_TMAG5273.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ int8_t TMAG5273::readWakeUpAndSleepData(float *xVal, float *yVal, float *zVal, f
200200
readRegisters(TMAG5273_T_MSB_RESULT, wakeupRegisterRead, 4);
201201

202202
// Need to get the values to themselves (bitwise operation)
203-
*zVal = wakeupRegisterRead[7];
204-
*yVal= wakeupRegisterRead[5];
205-
*xVal = wakeupRegisterRead[3];
206-
*temperature= wakeupRegisterRead[1];
203+
*zVal = (wakeupRegisterRead[6] << 8) & wakeupRegisterRead[7];
204+
*yVal= (wakeupRegisterRead[4] << 8) & wakeupRegisterRead[5];
205+
*xVal = (wakeupRegisterRead[2] << 8) & wakeupRegisterRead[3];
206+
*temperature= (wakeupRegisterRead[0] << 8) & wakeupRegisterRead[1];
207207

208208
// Reads to see if the range is set to 40mT or 80mT
209209
uint8_t rangeValXY = getXYAxisRange();

0 commit comments

Comments
 (0)