summaryrefslogtreecommitdiffstats
path: root/src/devices
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-08 18:57:50 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-08 18:57:50 +0100
commitb9efeb8b88fbd223e5fa948b50e4b9ba78c54540 (patch)
treec59a44da3ccaf047448ee663dc60b2a5838396fc /src/devices
parent4ae0064d98bddc466658ded48d9646ee163a43a0 (diff)
downloadads1x1x-async-b9efeb8b88fbd223e5fa948b50e4b9ba78c54540.tar.gz
ads1x1x-async-b9efeb8b88fbd223e5fa948b50e4b9ba78c54540.tar.xz
ads1x1x-async-b9efeb8b88fbd223e5fa948b50e4b9ba78c54540.zip
Create macro for IC markers
Diffstat (limited to 'src/devices')
-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);