nrf/saadc: make Input trait sealed.
This commit is contained in:
parent
0d709fa5c8
commit
d8c3365d6a
@ -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(crate) mod sealed {
|
||||||
pub trait Input: Unborrow<Target = Self> {
|
use super::*;
|
||||||
fn channel(&self) -> InputChannel;
|
|
||||||
|
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<Target = Self> {}
|
||||||
|
|
||||||
macro_rules! impl_saadc_input {
|
macro_rules! impl_saadc_input {
|
||||||
($pin:ident, $ch:ident) => {
|
($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 {
|
fn channel(&self) -> crate::saadc::InputChannel {
|
||||||
crate::saadc::InputChannel::$ch
|
crate::saadc::InputChannel::$ch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl crate::saadc::Input for crate::peripherals::$pin {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user