aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-nrf/src/saadc.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs
index 215f968a7..efcdfb2b1 100644
--- a/embassy-nrf/src/saadc.rs
+++ b/embassy-nrf/src/saadc.rs
@@ -78,6 +78,29 @@ pub struct ChannelConfig<'d> {
78 phantom: PhantomData<&'d ()>, 78 phantom: PhantomData<&'d ()>,
79} 79}
80 80
81/// A dummy `Input` pin implementation for SAADC peripheral sampling from the
82/// internal voltage.
83pub struct VddInput;
84
85unsafe impl Unborrow for VddInput {
86 type Target = VddInput;
87 unsafe fn unborrow(self) -> Self::Target {
88 self
89 }
90}
91
92impl sealed::Input for VddInput {
93 #[cfg(not(feature = "nrf9160"))]
94 fn channel(&self) -> InputChannel {
95 InputChannel::VDD
96 }
97 #[cfg(feature = "nrf9160")]
98 fn channel(&self) -> InputChannel {
99 InputChannel::VDDGPIO
100 }
101}
102impl Input for VddInput {}
103
81impl<'d> ChannelConfig<'d> { 104impl<'d> ChannelConfig<'d> {
82 /// Default configuration for single ended channel sampling. 105 /// Default configuration for single ended channel sampling.
83 pub fn single_ended(input: impl Unborrow<Target = impl Input> + 'd) -> Self { 106 pub fn single_ended(input: impl Unborrow<Target = impl Input> + 'd) -> Self {