diff options
author | Diego Barrios Romero <eldruin@gmail.com> | 2018-11-08 18:57:50 +0100 |
---|---|---|
committer | Diego Barrios Romero <eldruin@gmail.com> | 2018-11-08 18:57:50 +0100 |
commit | b9efeb8b88fbd223e5fa948b50e4b9ba78c54540 (patch) | |
tree | c59a44da3ccaf047448ee663dc60b2a5838396fc /src | |
parent | 4ae0064d98bddc466658ded48d9646ee163a43a0 (diff) | |
download | ads1x1x-async-b9efeb8b88fbd223e5fa948b50e4b9ba78c54540.tar.gz ads1x1x-async-b9efeb8b88fbd223e5fa948b50e4b9ba78c54540.tar.xz ads1x1x-async-b9efeb8b88fbd223e5fa948b50e4b9ba78c54540.zip |
Create macro for IC markers
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/ic.rs | 19 |
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); |