Skip to content

Commit

Permalink
chromium_ec: Implement Display for EcResponseGetHwDiag
Browse files Browse the repository at this point in the history
Debug for raw values, Display for human readable.

Signed-off-by: Daniel Schaefer <[email protected]>
  • Loading branch information
JohnAZoidberg committed Oct 31, 2023
1 parent d55d3c5 commit 1250929
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions framework_lib/src/chromium_ec/commands.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use core::fmt;

use num_derive::FromPrimitive;

use super::{command::*, input_deck::INPUT_DECK_SLOTS};
Expand Down Expand Up @@ -366,6 +368,18 @@ impl EcResponseGetHwDiag {
)
}
}
impl fmt::Display for EcResponseGetHwDiag {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let (left_fan, right_fan) = self.fan_fault();
write!(
f,
"BIOS Done: {}, Fan Fault Left: {}, Right: {}",
self.bios_complete != 0,
left_fan,
right_fan
)
}
}

impl EcRequest<EcResponseGetHwDiag> for EcRequestGetHwDiag {
fn command_id() -> EcCommands {
Expand Down

0 comments on commit 1250929

Please sign in to comment.