@@ -176,7 +176,7 @@ int8_t TMAG5273::writeRegisters(uint8_t regAddress, uint8_t *dataBuffer, uint8_t
176176uint8_t TMAG5273::readRegister (uint8_t regAddress)
177177{
178178 uint8_t regVal = 0 ;
179- readRegisters (regAddress, ®Val, 1 );
179+ readRegisters (regAddress, ®Val, 2 );
180180 return regVal;
181181}
182182
@@ -2536,11 +2536,8 @@ float TMAG5273::getTemp()
25362536// / @return X-Channel data conversion results
25372537float TMAG5273::getXData ()
25382538{
2539- int8_t xLSB = 0 ;
2540- int8_t xMSB = 0 ;
2541-
2542- xLSB = readRegister (TMAG5273_REG_X_LSB_RESULT);
2543- xMSB = readRegister (TMAG5273_REG_X_MSB_RESULT);
2539+ int8_t xLSB = readRegister (TMAG5273_REG_X_LSB_RESULT);
2540+ int8_t xMSB = readRegister (TMAG5273_REG_X_MSB_RESULT);
25442541
25452542 // Variable to store full X data
25462543 int16_t xData = 0 ;
@@ -2581,7 +2578,7 @@ float TMAG5273::getYData()
25812578 // Variable to store full Y data
25822579 int16_t yData = 0 ;
25832580 // Combines the two in one register where the MSB is shifted to the correct location
2584- yData = yLSB + (yMSB << 8 );
2581+ yData = yLSB + (yMSB << 8 );
25852582
25862583 // Reads to see if the range is set to 40mT or 80mT
25872584 uint8_t rangeValXY = getXYAxisRange ();
@@ -2617,7 +2614,7 @@ float TMAG5273::getZData()
26172614 // Variable to store full X data
26182615 int16_t zData = 0 ;
26192616 // Combines the two in one register where the MSB is shifted to the correct location
2620- zData = zLSB + (zMSB << 8 );
2617+ zData = zLSB + (zMSB << 8 );
26212618
26222619 // Reads to see if the range is set to 40mT or 80mT
26232620 uint8_t rangeValZ = getZAxisRange ();
@@ -2664,7 +2661,7 @@ float TMAG5273::getAngleResult()
26642661 float finalVal = 0 ;
26652662
26662663 // Combining the register value
2667- angleReg = angleLSB + (angleMSB << 8 );
2664+ angleReg = angleLSB + (angleMSB << 8 );
26682665
26692666 // Removing the uneeded bits for the fraction value
26702667 decValue = float (angleLSB & 0b1111 ) / 16 ;
0 commit comments