aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/saadc.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-04-05 00:20:22 +0200
committerDario Nieuwenhuis <[email protected]>2024-04-05 00:48:46 +0200
commitab85eb4b60cd49ebcd43d2305f42327685f5e5a6 (patch)
tree3c385a5703edcd1e791ec1934d3232dc4084ab2b /embassy-nrf/src/saadc.rs
parent0e1208947e89ea60bd1b5c85e4deb79efb94d89a (diff)
nrf: remove mod sealed.
Diffstat (limited to 'embassy-nrf/src/saadc.rs')
-rw-r--r--embassy-nrf/src/saadc.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs
index 662b05614..17c65fa3e 100644
--- a/embassy-nrf/src/saadc.rs
+++ b/embassy-nrf/src/saadc.rs
@@ -16,7 +16,6 @@ pub(crate) use saadc::ch::pselp::PSELP_A as InputChannel;
16use saadc::oversample::OVERSAMPLE_A; 16use saadc::oversample::OVERSAMPLE_A;
17use saadc::resolution::VAL_A; 17use saadc::resolution::VAL_A;
18 18
19use self::sealed::Input as _;
20use crate::interrupt::InterruptExt; 19use crate::interrupt::InterruptExt;
21use crate::ppi::{ConfigurableChannel, Event, Ppi, Task}; 20use crate::ppi::{ConfigurableChannel, Event, Ppi, Task};
22use crate::timer::{Frequency, Instance as TimerInstance, Timer}; 21use crate::timer::{Frequency, Instance as TimerInstance, Timer};
@@ -662,16 +661,13 @@ pub enum Resolution {
662 _14BIT = 3, 661 _14BIT = 3,
663} 662}
664 663
665pub(crate) mod sealed { 664pub(crate) trait SealedInput {
666 use super::*; 665 fn channel(&self) -> InputChannel;
667
668 pub trait Input {
669 fn channel(&self) -> InputChannel;
670 }
671} 666}
672 667
673/// An input that can be used as either or negative end of a ADC differential in the SAADC periperhal. 668/// An input that can be used as either or negative end of a ADC differential in the SAADC periperhal.
674pub trait Input: sealed::Input + Into<AnyInput> + Peripheral<P = Self> + Sized + 'static { 669#[allow(private_bounds)]
670pub trait Input: SealedInput + Into<AnyInput> + Peripheral<P = Self> + Sized + 'static {
675 /// Convert this SAADC input to a type-erased `AnyInput`. 671 /// Convert this SAADC input to a type-erased `AnyInput`.
676 /// 672 ///
677 /// This allows using several inputs in situations that might require 673 /// This allows using several inputs in situations that might require
@@ -693,7 +689,7 @@ pub struct AnyInput {
693 689
694impl_peripheral!(AnyInput); 690impl_peripheral!(AnyInput);
695 691
696impl sealed::Input for AnyInput { 692impl SealedInput for AnyInput {
697 fn channel(&self) -> InputChannel { 693 fn channel(&self) -> InputChannel {
698 self.channel 694 self.channel
699 } 695 }
@@ -706,7 +702,7 @@ macro_rules! impl_saadc_input {
706 impl_saadc_input!(@local, crate::peripherals::$pin, $ch); 702 impl_saadc_input!(@local, crate::peripherals::$pin, $ch);
707 }; 703 };
708 (@local, $pin:ty, $ch:ident) => { 704 (@local, $pin:ty, $ch:ident) => {
709 impl crate::saadc::sealed::Input for $pin { 705 impl crate::saadc::SealedInput for $pin {
710 fn channel(&self) -> crate::saadc::InputChannel { 706 fn channel(&self) -> crate::saadc::InputChannel {
711 crate::saadc::InputChannel::$ch 707 crate::saadc::InputChannel::$ch
712 } 708 }