mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
fixed rp adc tests
This commit is contained in:
parent
62d6bb6c8a
commit
0c97ce2fcc
@ -93,6 +93,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
adc.read_many(
|
adc.read_many(
|
||||||
&mut Channel::new_pin(&mut p.PIN_29, Pull::Down),
|
&mut Channel::new_pin(&mut p.PIN_29, Pull::Down),
|
||||||
&mut low,
|
&mut low,
|
||||||
|
1,
|
||||||
&mut p.DMA_CH0,
|
&mut p.DMA_CH0,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
@ -100,12 +101,18 @@ async fn main(_spawner: Spawner) {
|
|||||||
adc.read_many(
|
adc.read_many(
|
||||||
&mut Channel::new_pin(&mut p.PIN_29, Pull::None),
|
&mut Channel::new_pin(&mut p.PIN_29, Pull::None),
|
||||||
&mut none,
|
&mut none,
|
||||||
|
1,
|
||||||
&mut p.DMA_CH0,
|
&mut p.DMA_CH0,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
adc.read_many_raw(&mut Channel::new_pin(&mut p.PIN_29, Pull::Up), &mut up, &mut p.DMA_CH0)
|
adc.read_many_raw(
|
||||||
.await;
|
&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!(low.iter().zip(none.iter()).all(|(l, n)| *l >> 4 < *n as u16));
|
||||||
defmt::assert!(up.iter().all(|s| s.good()));
|
defmt::assert!(up.iter().all(|s| s.good()));
|
||||||
defmt::assert!(none.iter().zip(up.iter()).all(|(n, u)| (*n as u16) < u.value()));
|
defmt::assert!(none.iter().zip(up.iter()).all(|(n, u)| (*n as u16) < u.value()));
|
||||||
@ -115,6 +122,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
adc.read_many(
|
adc.read_many(
|
||||||
&mut Channel::new_temp_sensor(&mut p.ADC_TEMP_SENSOR),
|
&mut Channel::new_temp_sensor(&mut p.ADC_TEMP_SENSOR),
|
||||||
&mut temp,
|
&mut temp,
|
||||||
|
1,
|
||||||
&mut p.DMA_CH0,
|
&mut p.DMA_CH0,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
Loading…
Reference in New Issue
Block a user