Skip to content

Commit

Permalink
Merge pull request #800 from jannic/test-for-pr799
Browse files Browse the repository at this point in the history
This adds a test-case covering the fix from PR #799
  • Loading branch information
thejpster authored Jul 27, 2024
2 parents 956668e + b142a7b commit 186cce2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions on-target-tests/tests/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit 186cce2

Please sign in to comment.