Skip to content

Commit 7b32eca

Browse files
committed
fix spi datamask (word/int bug)
1 parent d1350df commit 7b32eca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/MagneticSensorSPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ word MagneticSensorSPI::read(word angle_register){
233233

234234
register_value = register_value >> (1 + data_start_bit - bit_resolution); //this should shift data to the rightmost bits of the word
235235

236-
const static word data_mask = ~(0 >> (16 - bit_resolution));
236+
const static word data_mask = 0xFFFF >> (16 - bit_resolution);
237237

238238
return register_value & data_mask; // Return the data, stripping the non data (e.g parity) bits
239239
}

0 commit comments

Comments
 (0)