707: Add saadc::VddhDiv5Input r=Dirbaio a=alexmoon

Adds support for the VDDHDIV5 ADC input on newer nrf chips.

Co-authored-by: alexmoon <alex.r.moon@gmail.com>
This commit is contained in:
bors[bot] 2022-04-08 20:38:45 +00:00 committed by GitHub
commit b2cdaa56c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,6 +102,29 @@ impl sealed::Input for VddInput {
}
impl Input for VddInput {}
/// A dummy `Input` pin implementation for SAADC peripheral sampling from the
/// VDDH / 5 voltage.
#[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))]
pub struct VddhDiv5Input;
#[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))]
unsafe impl Unborrow for VddhDiv5Input {
type Target = VddhDiv5Input;
unsafe fn unborrow(self) -> Self::Target {
self
}
}
#[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))]
impl sealed::Input for VddhDiv5Input {
fn channel(&self) -> InputChannel {
InputChannel::VDDHDIV5
}
}
#[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))]
impl Input for VddhDiv5Input {}
impl<'d> ChannelConfig<'d> {
/// Default configuration for single ended channel sampling.
pub fn single_ended(input: impl Unborrow<Target = impl Input> + 'd) -> Self {