From b142a7bb807e7dbc1b9a0d786d990eb269a59e23 Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Fri, 3 May 2024 06:16:26 +0000 Subject: [PATCH] This adds a test-case covering the fix from PR #799 --- on-target-tests/tests/gpio.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/on-target-tests/tests/gpio.rs b/on-target-tests/tests/gpio.rs index 6e4f2bf51..d3930d87c 100644 --- a/on-target-tests/tests/gpio.rs +++ b/on-target-tests/tests/gpio.rs @@ -149,4 +149,15 @@ mod tests { cortex_m::asm::delay(10); assert_eq!(group.read(), 0b1010); } + + #[test] + fn read_adc() { + use embedded_hal_0_2::adc::OneShot; + + // Safety: Test cases do not run in parallel + let mut pac = unsafe { pac::Peripherals::steal() }; + let mut adc = hal::Adc::new(pac.ADC, &mut pac.RESETS); + let mut temp_sensor = hal::adc::Adc::take_temp_sensor(&mut adc).unwrap(); + let _temperature: u16 = adc.read(&mut temp_sensor).unwrap(); + } }