Skip to content

Commit

Permalink
fixed rp adc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-epifanov committed Oct 9, 2023
1 parent 62d6bb6 commit 0c97ce2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/rp/src/bin/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,26 @@ async fn main(_spawner: Spawner) {
adc.read_many(
&mut Channel::new_pin(&mut p.PIN_29, Pull::Down),
&mut low,
1,
&mut p.DMA_CH0,
)
.await
.unwrap();
adc.read_many(
&mut Channel::new_pin(&mut p.PIN_29, Pull::None),
&mut none,
1,
&mut p.DMA_CH0,
)
.await
.unwrap();
adc.read_many_raw(&mut Channel::new_pin(&mut p.PIN_29, Pull::Up), &mut up, &mut p.DMA_CH0)
.await;
adc.read_many_raw(
&mut Channel::new_pin(&mut p.PIN_29, Pull::Up),
&mut up,
1,
&mut p.DMA_CH0,
)
.await;
defmt::assert!(low.iter().zip(none.iter()).all(|(l, n)| *l >> 4 < *n as u16));
defmt::assert!(up.iter().all(|s| s.good()));
defmt::assert!(none.iter().zip(up.iter()).all(|(n, u)| (*n as u16) < u.value()));
Expand All @@ -115,6 +122,7 @@ async fn main(_spawner: Spawner) {
adc.read_many(
&mut Channel::new_temp_sensor(&mut p.ADC_TEMP_SENSOR),
&mut temp,
1,
&mut p.DMA_CH0,
)
.await
Expand Down

0 comments on commit 0c97ce2

Please sign in to comment.