diff options
| author | xoviat <[email protected]> | 2025-11-10 09:56:42 -0600 |
|---|---|---|
| committer | xoviat <[email protected]> | 2025-11-10 09:56:42 -0600 |
| commit | 12b59dc610fb659a4d51ccc364865a7e154379d6 (patch) | |
| tree | 4d91375fb1ba72c65a5a50ab213181a03828c280 /examples/stm32wba6 | |
| parent | 1da05747c416c989a128aabbbde4b46df7bba9b9 (diff) | |
adc: remove sample_time from struct
Diffstat (limited to 'examples/stm32wba6')
| -rw-r--r-- | examples/stm32wba6/src/bin/adc.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/stm32wba6/src/bin/adc.rs b/examples/stm32wba6/src/bin/adc.rs index 8c80470b8..0887e124c 100644 --- a/examples/stm32wba6/src/bin/adc.rs +++ b/examples/stm32wba6/src/bin/adc.rs | |||
| @@ -17,15 +17,14 @@ async fn main(_spawner: embassy_executor::Spawner) { | |||
| 17 | let mut adc4_pin2 = p.PA1; // A5 | 17 | let mut adc4_pin2 = p.PA1; // A5 |
| 18 | adc4.set_resolution(adc4::Resolution::BITS12); | 18 | adc4.set_resolution(adc4::Resolution::BITS12); |
| 19 | adc4.set_averaging(adc4::Averaging::Samples256); | 19 | adc4.set_averaging(adc4::Averaging::Samples256); |
| 20 | adc4.set_sample_time(adc4::SampleTime::CYCLES1_5); | ||
| 21 | let max4 = adc4::resolution_to_max_count(adc4::Resolution::BITS12); | 20 | let max4 = adc4::resolution_to_max_count(adc4::Resolution::BITS12); |
| 22 | 21 | ||
| 23 | // **** ADC4 blocking read **** | 22 | // **** ADC4 blocking read **** |
| 24 | let raw: u16 = adc4.blocking_read(&mut adc4_pin1); | 23 | let raw: u16 = adc4.blocking_read(&mut adc4_pin1, adc4::SampleTime::CYCLES1_5); |
| 25 | let volt: f32 = 3.0 * raw as f32 / max4 as f32; | 24 | let volt: f32 = 3.0 * raw as f32 / max4 as f32; |
| 26 | info!("Read adc4 pin 1 {}", volt); | 25 | info!("Read adc4 pin 1 {}", volt); |
| 27 | 26 | ||
| 28 | let raw: u16 = adc4.blocking_read(&mut adc4_pin2); | 27 | let raw: u16 = adc4.blocking_read(&mut adc4_pin2, adc4::SampleTime::CYCLES1_5); |
| 29 | let volt: f32 = 3.3 * raw as f32 / max4 as f32; | 28 | let volt: f32 = 3.3 * raw as f32 / max4 as f32; |
| 30 | info!("Read adc4 pin 2 {}", volt); | 29 | info!("Read adc4 pin 2 {}", volt); |
| 31 | 30 | ||
