Skip to content

Commit 415e9a7

Browse files
committed
Fix 2's complement negative voltage bit mask
1 parent 5968796 commit 415e9a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/SparkFun_ADS1219.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ bool SfeADS1219Driver::readConversion()
135135
iu32.u32 = (iu32.u32 << 8) | rawBytes[1];
136136
iu32.u32 = (iu32.u32 << 8) | rawBytes[2];
137137
// Preserve the 2's complement.
138-
if (0x00100000 == (iu32.u32 & 0x00100000))
138+
if (0x00800000 == (iu32.u32 & 0x00800000))
139139
iu32.u32 = iu32.u32 | 0xFF000000;
140140
_adcResult = iu32.i32; // Store the signed result
141141
}

0 commit comments

Comments
 (0)