summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/devices/ic.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/devices/ic.rs b/src/devices/ic.rs
index 9795de6..81c8e44 100644
--- a/src/devices/ic.rs
+++ b/src/devices/ic.rs
@@ -9,14 +9,15 @@ pub trait Resolution : super::private::Sealed {
const BITS : ResolutionBits;
}
-/// ADS1013 IC marker
-pub struct Ads1013(());
-impl Resolution for Ads1013 {
- const BITS: ResolutionBits = ResolutionBits::_12;
+macro_rules! ic_marker {
+ ($name:ident, $resolution:ident) => {
+ /// IC marker
+ pub struct $name(());
+ impl Resolution for $name {
+ const BITS: ResolutionBits = ResolutionBits::$resolution;
+ }
+ };
}
-/// ADS1113 IC marker
-pub struct Ads1113(());
-impl Resolution for Ads1113 {
- const BITS: ResolutionBits = ResolutionBits::_16;
-} \ No newline at end of file
+ic_marker!(Ads1013, _12);
+ic_marker!(Ads1113, _16);