Skip to content

Commit

Permalink
power: Derive Debug, Clone, PartialEq, Eq for PowerInfo
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Schaefer <[email protected]>
  • Loading branch information
JohnAZoidberg committed Oct 19, 2023
1 parent 447501f commit ed4fe3e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions framework_lib/src/power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const EC_BATT_FLAG_DISCHARGING: u8 = 0x04;
const EC_BATT_FLAG_CHARGING: u8 = 0x08;
const EC_BATT_FLAG_LEVEL_CRITICAL: u8 = 0x10;

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BatteryInformation {
pub present_voltage: u32,
pub present_rate: u32,
Expand All @@ -89,6 +90,7 @@ pub struct BatteryInformation {
pub level_critical: bool,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PowerInfo {
pub ac_present: bool,
pub battery: Option<BatteryInformation>,
Expand Down Expand Up @@ -227,6 +229,7 @@ fn print_battery_information(power_info: &PowerInfo) {
);
println!(" Present Rate: {} mA", battery.present_rate);
// We only have a single battery in all our systems
// Both values are always 0
// println!(" Battery Count: {}", battery.battery_count);
// println!(" Current Battery#: {}", battery.current_battery_index);

Expand Down

0 comments on commit ed4fe3e

Please sign in to comment.