summaryrefslogtreecommitdiffstats
path: root/src/devices/ic.rs
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-07 20:19:06 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-07 20:19:06 +0100
commit28b16cc364cc4f4112aca2195df389ea6f007048 (patch)
treeaa14b2c5d06ee56acea022dfdbe67a6af7ab901c /src/devices/ic.rs
parenta502e4c40952777f0ac5f1fc759fe4f669d8500e (diff)
downloadads1x1x-async-28b16cc364cc4f4112aca2195df389ea6f007048.tar.gz
ads1x1x-async-28b16cc364cc4f4112aca2195df389ea6f007048.tar.xz
ads1x1x-async-28b16cc364cc4f4112aca2195df389ea6f007048.zip
Convert between modes through transformation of the struct
Diffstat (limited to 'src/devices/ic.rs')
-rw-r--r--src/devices/ic.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/devices/ic.rs b/src/devices/ic.rs
new file mode 100644
index 0000000..9795de6
--- /dev/null
+++ b/src/devices/ic.rs
@@ -0,0 +1,22 @@
+/// ICs
+#[derive(PartialEq)]
+pub enum ResolutionBits {
+ _12,
+ _16
+}
+
+pub trait Resolution : super::private::Sealed {
+ const BITS : ResolutionBits;
+}
+
+/// ADS1013 IC marker
+pub struct Ads1013(());
+impl Resolution for Ads1013 {
+ const BITS: ResolutionBits = ResolutionBits::_12;
+}
+
+/// ADS1113 IC marker
+pub struct Ads1113(());
+impl Resolution for Ads1113 {
+ const BITS: ResolutionBits = ResolutionBits::_16;
+} \ No newline at end of file