summaryrefslogtreecommitdiffstats
path: root/src/ic.rs
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-11 08:04:42 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-11 08:04:42 +0100
commit3e3a790d9f70bfd6cb4210dfe09560d0385fdf5a (patch)
tree8cf40e43cb93b15a774696c3af639d504addce8c /src/ic.rs
parent8b9e9ecdb85a30ac1c57fe6b96498cae6ad9f7cc (diff)
downloadads1x1x-async-3e3a790d9f70bfd6cb4210dfe09560d0385fdf5a.tar.gz
ads1x1x-async-3e3a790d9f70bfd6cb4210dfe09560d0385fdf5a.tar.xz
ads1x1x-async-3e3a790d9f70bfd6cb4210dfe09560d0385fdf5a.zip
Reorganize modules
Diffstat (limited to 'src/ic.rs')
-rw-r--r--src/ic.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/ic.rs b/src/ic.rs
new file mode 100644
index 0000000..7b30f85
--- /dev/null
+++ b/src/ic.rs
@@ -0,0 +1,42 @@
+/// ICs
+use private;
+
+#[derive(PartialEq)]
+pub enum ResolutionBits {
+ _12,
+ _16
+}
+
+pub trait Resolution : private::Sealed {
+ const BITS : ResolutionBits;
+}
+
+macro_rules! ic_marker {
+ ($name:ident, $resolution:ident) => {
+ /// IC marker
+ pub struct $name(());
+ impl Resolution for $name {
+ const BITS: ResolutionBits = ResolutionBits::$resolution;
+ }
+ };
+}
+
+ic_marker!(Ads1013, _12);
+ic_marker!(Ads1113, _16);
+ic_marker!(Ads1014, _12);
+ic_marker!(Ads1114, _16);
+ic_marker!(Ads1015, _12);
+ic_marker!(Ads1115, _16);
+
+pub trait Tier2Features : private::Sealed { }
+
+macro_rules! tier2_features {
+ ($name:ident) => {
+ impl Tier2Features for $name {}
+ }
+}
+
+tier2_features!(Ads1014);
+tier2_features!(Ads1114);
+tier2_features!(Ads1015);
+tier2_features!(Ads1115);