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 May 3, 2024
1 parent 3c6a13c commit 1553ea7
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 @@ -100,4 +100,15 @@ mod tests {
assert!(pac.PADS_BANK0.gpio(id).read().ie().bit_is_clear());
}
}

#[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 1553ea7

Please sign in to comment.