aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-rp/src/adc.rs21
1 files changed, 7 insertions, 14 deletions
diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs
index e0c2910b8..38b323ec9 100644
--- a/embassy-rp/src/adc.rs
+++ b/embassy-rp/src/adc.rs
@@ -223,28 +223,21 @@ impl interrupt::typelevel::Handler<interrupt::typelevel::ADC_IRQ_FIFO> for Inter
223} 223}
224 224
225mod sealed { 225mod sealed {
226 pub trait AdcChannel { 226 pub trait AdcChannel {}
227 fn channel(&mut self) -> u8;
228 }
229} 227}
230 228
231pub trait AdcChannel: sealed::AdcChannel {} 229pub trait AdcChannel: sealed::AdcChannel {}
232pub trait AdcPin: AdcChannel + gpio::Pin {} 230pub trait AdcPin: AdcChannel + gpio::Pin {}
233 231
234macro_rules! impl_pin { 232macro_rules! impl_pin {
235 ($pin:ident, $channel:expr) => { 233 ($pin:ident) => {
236 impl sealed::AdcChannel for peripherals::$pin { 234 impl sealed::AdcChannel for peripherals::$pin {}
237 fn channel(&mut self) -> u8 {
238 $channel
239 }
240 }
241
242 impl AdcChannel for peripherals::$pin {} 235 impl AdcChannel for peripherals::$pin {}
243 impl AdcPin for peripherals::$pin {} 236 impl AdcPin for peripherals::$pin {}
244 }; 237 };
245} 238}
246 239
247impl_pin!(PIN_26, 0); 240impl_pin!(PIN_26);
248impl_pin!(PIN_27, 1); 241impl_pin!(PIN_27);
249impl_pin!(PIN_28, 2); 242impl_pin!(PIN_28);
250impl_pin!(PIN_29, 3); 243impl_pin!(PIN_29);