Skip to content

Commit b4eae29

Browse files
bors[bot]taruti
andauthored
Merge #297
297: Support vddhdiv5 for saadc r=jonas-schievink a=taruti Support using vddhdiv5 as a source to the saadc. Co-authored-by: Taru Karttunen <[email protected]>
2 parents f06e303 + 4e00bac commit b4eae29

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

nrf-hal-common/src/saadc.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ where
178178
7 => self.0.ch[0].pselp.write(|w| w.pselp().analog_input7()),
179179
#[cfg(not(feature = "9160"))]
180180
8 => self.0.ch[0].pselp.write(|w| w.pselp().vdd()),
181+
#[cfg(any(feature = "52833", feature = "52840"))]
182+
13 => self.0.ch[0].pselp.write(|w| w.pselp().vddhdiv5()),
181183
// This can never happen the only analog pins have already been defined
182184
// PAY CLOSE ATTENTION TO ANY CHANGES TO THIS IMPL OR THE `channel_mappings!` MACRO
183185
_ => unsafe { unreachable_unchecked() },
@@ -265,3 +267,16 @@ impl Channel<Saadc> for InternalVdd {
265267
#[cfg(not(feature = "9160"))]
266268
/// Channel that doesn't sample a pin, but the internal VDD voltage.
267269
pub struct InternalVdd;
270+
271+
#[cfg(any(feature = "52833", feature = "52840"))]
272+
impl Channel<Saadc> for InternalVddHdiv5 {
273+
type ID = u8;
274+
275+
fn channel() -> <Self as embedded_hal::adc::Channel<Saadc>>::ID {
276+
13
277+
}
278+
}
279+
280+
#[cfg(any(feature = "52833", feature = "52840"))]
281+
/// The voltage on the VDDH pin, divided by 5.
282+
pub struct InternalVddHdiv5;

0 commit comments

Comments
 (0)