pub struct Configuration {
pub reset: bool,
pub bus_range: BusRange,
pub gain: Gain,
pub bus_adc: Adc,
pub shunt_adc: Adc,
pub mode: Mode,
}Expand description
The Configuration register (00h).
The default is the reset state, CONFIG_RESET: 32 V range, gain 1/8, 12-bit
conversions, shunt and bus continuous.
Fields§
§reset: boolReset the part as at power-on; the bit clears itself.
bus_range: BusRangeBus voltage range, BRNG in bit 13.
gain: GainShunt gain and range, PG in bits 12:11.
bus_adc: AdcBus ADC resolution or averaging, BADC in bits 10:7.
shunt_adc: AdcShunt ADC resolution or averaging, SADC in bits 6:3.
mode: ModeOperating mode, MODE in bits 2:0.
Implementations§
Source§impl Configuration
impl Configuration
Sourcepub fn from_bits(bits: u16) -> Configuration
pub fn from_bits(bits: u16) -> Configuration
Decodes a register word.
§Arguments
bits- the word read fromregister::CONFIGURATION.
§Returns
The decoded settings.
Sourcepub fn conversion_micros(self) -> u32
pub fn conversion_micros(self) -> u32
Returns how long one conversion cycle of the mode takes, in microseconds.
A shunt conversion and a bus conversion run one after the other, so the time is the sum of whichever the mode measures.
Trait Implementations§
Source§impl Clone for Configuration
impl Clone for Configuration
Source§fn clone(&self) -> Configuration
fn clone(&self) -> Configuration
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for Configuration
Source§impl Debug for Configuration
impl Debug for Configuration
Source§impl Default for Configuration
impl Default for Configuration
Source§fn default() -> Configuration
fn default() -> Configuration
Returns the “default value” for a type. Read more
impl Eq for Configuration
Source§impl PartialEq for Configuration
impl PartialEq for Configuration
impl StructuralPartialEq for Configuration
Auto Trait Implementations§
impl Freeze for Configuration
impl RefUnwindSafe for Configuration
impl Send for Configuration
impl Sync for Configuration
impl Unpin for Configuration
impl UnsafeUnpin for Configuration
impl UnwindSafe for Configuration
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