diff options
author | Diego Barrios Romero <eldruin@gmail.com> | 2018-11-17 07:51:12 +0100 |
---|---|---|
committer | Diego Barrios Romero <eldruin@gmail.com> | 2018-11-17 07:51:12 +0100 |
commit | 9d005392012213dc12527b913a9ea4f72b97368c (patch) | |
tree | a7636f5dacb56190aaa15f06d2524ed8d6b9c753 /src/lib.rs | |
parent | 5f58ec2dbf656e9c29e14c28103a87c125797d52 (diff) | |
download | ads1x1x-async-9d005392012213dc12527b913a9ea4f72b97368c.tar.gz ads1x1x-async-9d005392012213dc12527b913a9ea4f72b97368c.tar.xz ads1x1x-async-9d005392012213dc12527b913a9ea4f72b97368c.zip |
Add support for setting the full-scale range (PGA)
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -292,6 +292,27 @@ pub enum ComparatorQueue { Four, } +/// Full-scale range configuration for the programmable gain amplifier (PGA) (only for ADS1x14, ADS1x15) +/// +/// This sets the input voltage measurable range. +/// The FSR is fixed at ±2.048 V in the ADS1x13. +#[derive(Clone, Copy, Debug)] +#[allow(non_camel_case_types)] +pub enum FullScaleRange { + /// The measurable range is ±6.144V. + Within6_144V, + /// The measurable range is ±4.096V. + Within4_096V, + /// The measurable range is ±2.048V. (default) + Within2_048V, + /// The measurable range is ±1.024V. + Within1_024V, + /// The measurable range is ±0.512V. + Within0_512V, + /// The measurable range is ±0.256V. + Within0_256V, +} + /// Possible slave addresses #[derive(Debug, Clone)] pub enum SlaveAddr { @@ -330,11 +351,14 @@ impl Register { struct BitFlags; impl BitFlags { - const OP_MODE : u16 = 0b0000_0001_0000_0000; const OS : u16 = 0b1000_0000_0000_0000; const MUX2 : u16 = 0b0100_0000_0000_0000; const MUX1 : u16 = 0b0010_0000_0000_0000; const MUX0 : u16 = 0b0001_0000_0000_0000; + const PGA2 : u16 = 0b0000_1000_0000_0000; + const PGA1 : u16 = 0b0000_0100_0000_0000; + const PGA0 : u16 = 0b0000_0010_0000_0000; + const OP_MODE : u16 = 0b0000_0001_0000_0000; const DR2 : u16 = 0b0000_0000_1000_0000; const DR1 : u16 = 0b0000_0000_0100_0000; const DR0 : u16 = 0b0000_0000_0010_0000; |