diff --git a/firmware-updater/src/bootloader.rs b/firmware-updater/src/bootloader.rs index 1fa4f1d74d412f77423ab6bb950301f7bf35725e..bdab19276ba2ea5185acf38681e5e9bb09983fd4 100644 --- a/firmware-updater/src/bootloader.rs +++ b/firmware-updater/src/bootloader.rs @@ -9,12 +9,8 @@ use tele0592::{ use crate::elf_loader::Segment; -fn version_from_bytes(bytes: [u8; 3]) -> Version { - Version::new( - u64::from(bytes[0]), - u64::from(bytes[1]), - u64::from(bytes[2]), - ) +fn version_from_bytes((major, minor, patch): (u8, u8, u8)) -> Version { + Version::new(u64::from(major), u64::from(minor), u64::from(patch)) } pub enum ActiveProgram { diff --git a/tele0592/src/device.rs b/tele0592/src/device.rs index fc9afc3b5f77235d756b5d62c6a21cf1f6f89bd1..c4990be10dc414802a39a6c46c184671a3a93857 100644 --- a/tele0592/src/device.rs +++ b/tele0592/src/device.rs @@ -64,10 +64,10 @@ pub trait Device { /// /// # Errors /// This method may fail if the communication with the board fails. - fn firmware_version(&mut self) -> Result<[u8; 3], Self::I2cError> { + fn firmware_version(&mut self) -> Result<(u8, u8, u8), Self::I2cError> { let mut result = [0; 3]; self.write_read([CMD_FIRMWARE_VERSION], &mut result)?; - Ok(result) + Ok(result.into()) } /// Identify the program currently running on the board as the