From d8c3365d6a78f272a28ee9c2740d4e7543dde474 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 13 Oct 2021 22:01:39 +0200 Subject: [PATCH] nrf/saadc: make Input trait sealed. --- embassy-nrf/src/saadc.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs index 7f81d255..c2787e02 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> { } } -/// An input that can be used as either or negative end of a ADC differential in the SAADC periperhal. -pub trait Input: Unborrow { - fn channel(&self) -> InputChannel; +pub(crate) mod sealed { + use super::*; + + pub trait Input { + fn channel(&self) -> InputChannel; + } } +/// An input that can be used as either or negative end of a ADC differential in the SAADC periperhal. +pub trait Input: sealed::Input + Unborrow {} + macro_rules! impl_saadc_input { ($pin:ident, $ch:ident) => { - impl crate::saadc::Input for crate::peripherals::$pin { + impl crate::saadc::sealed::Input for crate::peripherals::$pin { fn channel(&self) -> crate::saadc::InputChannel { crate::saadc::InputChannel::$ch } } + impl crate::saadc::Input for crate::peripherals::$pin {} }; }