pub struct Configuration {
pub reset: bool,
pub averaging: Averaging,
pub bus_conversion_time: ConversionTime,
pub shunt_conversion_time: ConversionTime,
pub mode: Mode,
}Expand description
The configuration register (0x00), decoded into its fields.
Bit 14 is reserved and reads as 1 after reset; Configuration::to_register
writes it that way so the reset value round-trips unchanged.
Fields§
§reset: boolSet to trigger a system reset equivalent to power-on; the bit self-clears.
averaging: AveragingHow many samples are averaged before the result registers update.
bus_conversion_time: ConversionTimeThe conversion time for each bus voltage measurement.
shunt_conversion_time: ConversionTimeThe conversion time for each shunt voltage measurement.
mode: ModeWhich inputs are converted, and whether once or continuously.
Implementations§
Source§impl Configuration
impl Configuration
Sourcepub const RESET: Self
pub const RESET: Self
The power-on configuration, the decoded form of CONFIG_RESET.
Sourcepub fn from_register(raw: u16) -> Self
pub fn from_register(raw: u16) -> Self
Sourcepub fn to_register(self) -> u16
pub fn to_register(self) -> u16
Encodes the fields as a configuration register value.
§Returns
The 16-bit register to write, with reserved bit 14 set as at reset.
Sourcepub fn update_microseconds(self) -> u32
pub fn update_microseconds(self) -> u32
Returns how often the result registers update with these settings.
One update takes the averaged sample count times the sum of the conversion times of the inputs the mode measures, as the datasheet’s timing examples work it.
§Returns
The update interval in microseconds, or 0 in power-down.
Trait Implementations§
Source§impl Clone for Configuration
impl Clone for Configuration
Source§fn clone(&self) -> Configuration
fn clone(&self) -> Configuration
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Configuration
Source§impl Debug for Configuration
impl Debug for Configuration
Source§impl Default for Configuration
impl Default for Configuration
impl Eq for Configuration
Source§impl PartialEq for Configuration
impl PartialEq for Configuration
Source§fn eq(&self, other: &Configuration) -> bool
fn eq(&self, other: &Configuration) -> bool
self and other values to be equal, and is used by ==.