diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-04-08 20:38:45 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-04-08 20:38:45 +0000 |
| commit | b2cdaa56c1dca5ce293dad3b1e450f97bcf85251 (patch) | |
| tree | 51f0be7626dea28cd3abbf2e315c0b64ea03ed9b | |
| parent | e898b4e6838ff1f8d48af058add8eef0d6e60242 (diff) | |
| parent | 9c6d49961b4fdd8caa72d07479f94eb1c932fd43 (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.rs | 23 |
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 | } |
| 103 | impl Input for VddInput {} | 103 | impl 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"))] | ||
| 108 | pub struct VddhDiv5Input; | ||
| 109 | |||
| 110 | #[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))] | ||
| 111 | unsafe 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"))] | ||
| 119 | impl 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"))] | ||
| 126 | impl Input for VddhDiv5Input {} | ||
| 127 | |||
| 105 | impl<'d> ChannelConfig<'d> { | 128 | impl<'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 { |
