aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-nrf/src/saadc.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs
index 7f81d255f..c2787e02b 100644
--- a/embassy-nrf/src/saadc.rs
+++ b/embassy-nrf/src/saadc.rs
@@ -228,17 +228,24 @@ impl<'d, const N: usize> Drop for OneShot<'d, N> {
228 } 228 }
229} 229}
230 230
231/// An input that can be used as either or negative end of a ADC differential in the SAADC periperhal. 231pub(crate) mod sealed {
232pub trait Input: Unborrow<Target = Self> { 232 use super::*;
233 fn channel(&self) -> InputChannel; 233
234 pub trait Input {
235 fn channel(&self) -> InputChannel;
236 }
234} 237}
235 238
239/// An input that can be used as either or negative end of a ADC differential in the SAADC periperhal.
240pub trait Input: sealed::Input + Unborrow<Target = Self> {}
241
236macro_rules! impl_saadc_input { 242macro_rules! impl_saadc_input {
237 ($pin:ident, $ch:ident) => { 243 ($pin:ident, $ch:ident) => {
238 impl crate::saadc::Input for crate::peripherals::$pin { 244 impl crate::saadc::sealed::Input for crate::peripherals::$pin {
239 fn channel(&self) -> crate::saadc::InputChannel { 245 fn channel(&self) -> crate::saadc::InputChannel {
240 crate::saadc::InputChannel::$ch 246 crate::saadc::InputChannel::$ch
241 } 247 }
242 } 248 }
249 impl crate::saadc::Input for crate::peripherals::$pin {}
243 }; 250 };
244} 251}