@@ -176,7 +176,7 @@ int8_t TMAG5273::writeRegisters(uint8_t regAddress, uint8_t *dataBuffer, uint8_t
176
176
uint8_t TMAG5273::readRegister (uint8_t regAddress)
177
177
{
178
178
uint8_t regVal = 0 ;
179
- readRegisters (regAddress, ®Val, 1 );
179
+ readRegisters (regAddress, ®Val, 2 );
180
180
return regVal;
181
181
}
182
182
@@ -2536,11 +2536,8 @@ float TMAG5273::getTemp()
2536
2536
// / @return X-Channel data conversion results
2537
2537
float TMAG5273::getXData ()
2538
2538
{
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);
2544
2541
2545
2542
// Variable to store full X data
2546
2543
int16_t xData = 0 ;
@@ -2581,7 +2578,7 @@ float TMAG5273::getYData()
2581
2578
// Variable to store full Y data
2582
2579
int16_t yData = 0 ;
2583
2580
// 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 );
2585
2582
2586
2583
// Reads to see if the range is set to 40mT or 80mT
2587
2584
uint8_t rangeValXY = getXYAxisRange ();
@@ -2617,7 +2614,7 @@ float TMAG5273::getZData()
2617
2614
// Variable to store full X data
2618
2615
int16_t zData = 0 ;
2619
2616
// 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 );
2621
2618
2622
2619
// Reads to see if the range is set to 40mT or 80mT
2623
2620
uint8_t rangeValZ = getZAxisRange ();
@@ -2664,7 +2661,7 @@ float TMAG5273::getAngleResult()
2664
2661
float finalVal = 0 ;
2665
2662
2666
2663
// Combining the register value
2667
- angleReg = angleLSB + (angleMSB << 8 );
2664
+ angleReg = angleLSB + (angleMSB << 8 );
2668
2665
2669
2666
// Removing the uneeded bits for the fraction value
2670
2667
decValue = float (angleLSB & 0b1111 ) / 16 ;
0 commit comments