mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilibj] Fix ADIS16470 Gyro (#7434)
This commit is contained in:
@@ -426,6 +426,10 @@ public class ADIS16470_IMU implements AutoCloseable, Sendable {
|
||||
return m_connected;
|
||||
}
|
||||
|
||||
private static int toUShort(int upper, int lower) {
|
||||
return ((upper & 0xFF) << 8) + (lower & 0xFF);
|
||||
}
|
||||
|
||||
private static int toShort(int upper, int lower) {
|
||||
return (short) (((upper & 0xFF) << 8) + (lower & 0xFF));
|
||||
}
|
||||
@@ -609,7 +613,7 @@ public class ADIS16470_IMU implements AutoCloseable, Sendable {
|
||||
m_spi.write(buf, 2);
|
||||
m_spi.read(false, buf, 2);
|
||||
|
||||
return (buf[0] << 8) & buf[1];
|
||||
return toUShort(buf[0], buf[1]);
|
||||
}
|
||||
|
||||
private void writeRegister(int reg, int val) {
|
||||
|
||||
Reference in New Issue
Block a user