Use std u16 interpretation

This commit is contained in:
Frederik Menke 2023-06-28 19:38:04 +02:00
parent cc5270707e
commit f5d4d25d37

View file

@ -152,8 +152,7 @@ fn parse_i2c_message(bytes: &[u8]) -> Result<I2CMessage, ()> {
return Err(());
}
if bytes.len() >= 3 && bytes[0] == i2c_registers::SPINDLE_SPEED {
let speed_lower: u16 = bytes[1].into();
let speed_higher: u16 = bytes[2].into();
let speed = u16::from_le_bytes(bytes[1..3]);
let speed = (speed_higher << 8) + speed_lower;
Ok(I2CMessage::SpindleSpeed(speed))
} else {