summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2019-03-30 13:36:06 +0200
committerDiego Barrios Romero <eldruin@gmail.com>2019-03-31 13:41:26 +0200
commit50223ad02e2f487540107e320c8bef40a9849582 (patch)
tree58b4e44e2261940d07aba96b8d8e83457e641f53 /src/lib.rs
parentab1221e175f2da577c7a3fb510b5ae5cf41b0697 (diff)
downloadads1x1x-async-50223ad02e2f487540107e320c8bef40a9849582.tar.gz
ads1x1x-async-50223ad02e2f487540107e320c8bef40a9849582.tar.xz
ads1x1x-async-50223ad02e2f487540107e320c8bef40a9849582.zip
Format code
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs55
1 files changed, 26 insertions, 29 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c6716b9..b5abe4d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -388,9 +388,7 @@ impl SlaveAddr {
fn addr(self, default: u8) -> u8 {
match self {
SlaveAddr::Default => default,
- SlaveAddr::Alternative(a1, a0) => default |
- ((a1 as u8) << 1) |
- a0 as u8
+ SlaveAddr::Alternative(a1, a0) => default | ((a1 as u8) << 1) | a0 as u8,
}
}
}
@@ -398,33 +396,32 @@ impl SlaveAddr {
struct Register;
impl Register {
- const CONVERSION : u8 = 0x00;
- const CONFIG : u8 = 0x01;
- const LOW_TH : u8 = 0x02;
- const HIGH_TH : u8 = 0x03;
+ const CONVERSION: u8 = 0x00;
+ const CONFIG: u8 = 0x01;
+ const LOW_TH: u8 = 0x02;
+ const HIGH_TH: u8 = 0x03;
}
struct BitFlags;
impl BitFlags {
- 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;
- const COMP_MODE : u16 = 0b0000_0000_0001_0000;
- const COMP_POL : u16 = 0b0000_0000_0000_1000;
- const COMP_LAT : u16 = 0b0000_0000_0000_0100;
- const COMP_QUE1 : u16 = 0b0000_0000_0000_0010;
- const COMP_QUE0 : u16 = 0b0000_0000_0000_0001;
+ 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;
+ const COMP_MODE: u16 = 0b0000_0000_0001_0000;
+ const COMP_POL: u16 = 0b0000_0000_0000_1000;
+ const COMP_LAT: u16 = 0b0000_0000_0000_0100;
+ const COMP_QUE1: u16 = 0b0000_0000_0000_0010;
+ const COMP_QUE0: u16 = 0b0000_0000_0000_0001;
}
-
#[derive(Debug, Clone, PartialEq)]
struct Config {
bits: u16,
@@ -471,17 +468,17 @@ pub struct Ads1x1x<DI, IC, CONV, MODE> {
_mode: PhantomData<MODE>,
}
-#[doc(hidden)]
-pub mod interface;
+mod channels;
#[doc(hidden)]
pub mod ic;
-mod channels;
+#[doc(hidden)]
+pub mod interface;
pub use channels::channel;
-mod devices;
mod construction;
mod conversion;
-pub use conversion::ConvertThreshold;
+mod devices;
pub use conversion::ConvertMeasurement;
+pub use conversion::ConvertThreshold;
mod private {
use super::{ic, interface};