pub struct Reading {
pub shunt: i16,
pub bus: u16,
pub current: i16,
pub power: u16,
pub current_lsb_microamps: u32,
pub math_overflow: bool,
}Expand description
One set of results, with the current resolution they were taken at.
The four data registers are kept as read; the methods apply the datasheet’s scaling. The overflow flag is the one the Mask/Enable register carried when the conversion finished.
Fields§
§shunt: i16The Shunt Voltage register.
bus: u16The Bus Voltage register.
current: i16The Current register.
power: u16The Power register.
current_lsb_microamps: u32The programmed current resolution, in microamps per count.
math_overflow: boolThe math overflow flag: the current and power may be invalid.
Implementations§
Source§impl Reading
impl Reading
Sourcepub fn shunt_nanovolts(&self) -> i32
pub fn shunt_nanovolts(&self) -> i32
Returns the shunt voltage in nanovolts.
Sourcepub fn shunt_millivolts(&self) -> f32
pub fn shunt_millivolts(&self) -> f32
Returns the shunt voltage in millivolts.
Sourcepub fn bus_microvolts(&self) -> u32
pub fn bus_microvolts(&self) -> u32
Returns the bus voltage in microvolts.
Sourcepub fn current_microamps(&self) -> i32
pub fn current_microamps(&self) -> i32
Returns the current in microamps.
Sourcepub fn current_amps(&self) -> f32
pub fn current_amps(&self) -> f32
Returns the current in amps.
Sourcepub fn power_microwatts(&self) -> u32
pub fn power_microwatts(&self) -> u32
Returns the power in microwatts.
Sourcepub fn power_watts(&self) -> f32
pub fn power_watts(&self) -> f32
Returns the power in watts.
Trait Implementations§
impl Copy for Reading
impl Eq for Reading
impl StructuralPartialEq for Reading
Auto Trait Implementations§
impl Freeze for Reading
impl RefUnwindSafe for Reading
impl Send for Reading
impl Sync for Reading
impl Unpin for Reading
impl UnsafeUnpin for Reading
impl UnwindSafe for Reading
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more