aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-04-08 20:38:45 +0000
committerGitHub <[email protected]>2022-04-08 20:38:45 +0000
commitb2cdaa56c1dca5ce293dad3b1e450f97bcf85251 (patch)
tree51f0be7626dea28cd3abbf2e315c0b64ea03ed9b
parente898b4e6838ff1f8d48af058add8eef0d6e60242 (diff)
parent9c6d49961b4fdd8caa72d07479f94eb1c932fd43 (diff)
Merge #707
707: Add saadc::VddhDiv5Input r=Dirbaio a=alexmoon Adds support for the VDDHDIV5 ADC input on newer nrf chips. Co-authored-by: alexmoon <[email protected]>
-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 c4de7315f..61bc1fbda 100644
--- a/embassy-nrf/src/saadc.rs
+++ b/embassy-nrf/src/saadc.rs
@@ -102,6 +102,29 @@ impl sealed::Input for VddInput {
102} 102}
103impl Input for VddInput {} 103impl Input for VddInput {}
104 104
105/// A dummy `Input` pin implementation for SAADC peripheral sampling from the
106/// VDDH / 5 voltage.
107#[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))]
108pub struct VddhDiv5Input;
109
110#[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))]
111unsafe impl Unborrow for VddhDiv5Input {
112 type Target = VddhDiv5Input;
113 unsafe fn unborrow(self) -> Self::Target {
114 self
115 }
116}
117
118#[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))]
119impl sealed::Input for VddhDiv5Input {
120 fn channel(&self) -> InputChannel {
121 InputChannel::VDDHDIV5
122 }
123}
124
125#[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))]
126impl Input for VddhDiv5Input {}
127
105impl<'d> ChannelConfig<'d> { 128impl<'d> ChannelConfig<'d> {
106 /// Default configuration for single ended channel sampling. 129 /// Default configuration for single ended channel sampling.
107 pub fn single_ended(input: impl Unborrow<Target = impl Input> + 'd) -> Self { 130 pub fn single_ended(input: impl Unborrow<Target = impl Input> + 'd) -> Self {