Skip to content

Commit

Permalink
This adds a test-case covering the fix from PR #799
Browse files Browse the repository at this point in the history
  • Loading branch information
jannic committed Jul 27, 2024
1 parent 956668e commit b142a7b
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 b142a7b

Please sign in to comment.