Skip to content
Snippets Groups Projects
Commit 85f8c997 authored by Samuel Tardieu's avatar Samuel Tardieu
Browse files

Use tuple as documented to return firmware version

parent 7bd439aa
No related branches found
No related tags found
1 merge request!43Use tuple as documented to return firmware version
Pipeline #99083 canceled
......@@ -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 {
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment