pub struct Config {
pub start_conversion: bool,
pub mux: Mux,
pub pga: Pga,
pub mode: Mode,
pub data_rate: DataRate,
pub comparator_mode: ComparatorMode,
pub comparator_polarity: ComparatorPolarity,
pub comparator_latch: ComparatorLatch,
pub comparator_queue: ComparatorQueue,
}Expand description
A decoded ADS1115 Config register.
Build one, set the fields, and turn it into the 16-bit register value with
bits; or parse a register read with from_bits.
Config::default is the power-on state, 0x8583.
§Examples
use pamoja_sensors::ads1115::{Config, Mux, Pga};
// Read AIN0 against ground at the ±4.096 V range, leaving everything else default.
let config = Config {
mux: Mux::Ain0Gnd,
pga: Pga::Fsr4_096,
..Config::default()
};
// The high byte then low byte are written to the Config register.
let [hi, lo] = config.bits().to_be_bytes();
assert_eq!(Config::from_bits(u16::from_be_bytes([hi, lo])), config);Fields§
§start_conversion: boolStart a single conversion when written; reads as “not converting” when set.
mux: MuxThe input multiplexer setting.
pga: PgaThe full-scale range.
mode: ModeThe conversion mode.
data_rate: DataRateThe output data rate.
comparator_mode: ComparatorModeThe comparator mode.
comparator_polarity: ComparatorPolarityThe ALERT/RDY pin polarity.
comparator_latch: ComparatorLatchWhether the comparator latches.
comparator_queue: ComparatorQueueThe comparator queue, or disable.
Implementations§
Trait Implementations§
impl Copy for Config
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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