Skip to content

Commit

Permalink
Merge pull request #16 from sjoerdsimons/unit-sizes
Browse files Browse the repository at this point in the history
pdo: expand storage types to cover common units
  • Loading branch information
fmckeogh authored May 29, 2024
2 parents a8c7ab6 + 8622122 commit ad17cc7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions usb-pd/src/messages/pdo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,16 @@ bitfield! {
}

impl SPRProgrammablePowerSupply {
pub fn max_voltage(&self) -> si::u8::ElectricPotential {
si::u8::ElectricPotential::new::<decivolt>(self.raw_max_voltage())
pub fn max_voltage(&self) -> si::u16::ElectricPotential {
si::u16::ElectricPotential::new::<decivolt>(self.raw_max_voltage().into())
}

pub fn min_voltage(&self) -> si::u8::ElectricPotential {
si::u8::ElectricPotential::new::<decivolt>(self.raw_min_voltage())
pub fn min_voltage(&self) -> si::u16::ElectricPotential {
si::u16::ElectricPotential::new::<decivolt>(self.raw_min_voltage().into())
}

pub fn max_current(&self) -> si::u8::ElectricCurrent {
si::u8::ElectricCurrent::new::<_50milliamperes>(self.raw_max_current())
pub fn max_current(&self) -> si::u16::ElectricCurrent {
si::u16::ElectricCurrent::new::<_50milliamperes>(self.raw_max_current().into())
}
}

Expand All @@ -216,8 +216,8 @@ impl EPRAdjustableVoltageSupply {
si::u16::ElectricPotential::new::<decivolt>(self.raw_max_voltage())
}

pub fn min_voltage(&self) -> si::u8::ElectricPotential {
si::u8::ElectricPotential::new::<decivolt>(self.raw_min_voltage())
pub fn min_voltage(&self) -> si::u16::ElectricPotential {
si::u16::ElectricPotential::new::<decivolt>(self.raw_min_voltage().into())
}

pub fn pd_power(&self) -> si::u8::Power {
Expand Down

0 comments on commit ad17cc7

Please sign in to comment.