diff options
| author | Gabriel Smith <[email protected]> | 2025-12-16 12:27:43 -0500 |
|---|---|---|
| committer | Gabriel Smith <[email protected]> | 2025-12-16 12:30:36 -0500 |
| commit | b9395180fba64d42fb3e0977f4882d7555488c2f (patch) | |
| tree | cdc4a55fd2bb11469bf02733282deef2d33bd762 /embassy-stm32 | |
| parent | c283ba36eb5516cdedc46acf6f9f234859161e2a (diff) | |
stm32/adc: allow DMA reads to loop through enabled channels
This was previously implemented for v3 ADCs, but that was lost in the
recent refactoring. I have gone through all the reference manuals to
verify that this should be supported for all chips, but it has only
been confirmed for the STM32H5 series.
Diffstat (limited to 'embassy-stm32')
| -rw-r--r-- | embassy-stm32/CHANGELOG.md | 1 | ||||
| -rw-r--r-- | embassy-stm32/src/adc/mod.rs | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/embassy-stm32/CHANGELOG.md b/embassy-stm32/CHANGELOG.md index d26f1acdd..4853f1563 100644 --- a/embassy-stm32/CHANGELOG.md +++ b/embassy-stm32/CHANGELOG.md | |||
| @@ -94,6 +94,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 94 | - fix: stm32l47*/stm32l48* adc analog pin setup | 94 | - fix: stm32l47*/stm32l48* adc analog pin setup |
| 95 | - fix: keep stm32/sai: make NODIV independent of MCKDIV | 95 | - fix: keep stm32/sai: make NODIV independent of MCKDIV |
| 96 | - fix: Source system clock from MSIS before (de)configuring PLLs on STM32U5 | 96 | - fix: Source system clock from MSIS before (de)configuring PLLs on STM32U5 |
| 97 | - feat: adc: allow DMA reads to loop through enabled channels | ||
| 97 | 98 | ||
| 98 | ## 0.4.0 - 2025-08-26 | 99 | ## 0.4.0 - 2025-08-26 |
| 99 | 100 | ||
diff --git a/embassy-stm32/src/adc/mod.rs b/embassy-stm32/src/adc/mod.rs index da432f6ce..17b1dae77 100644 --- a/embassy-stm32/src/adc/mod.rs +++ b/embassy-stm32/src/adc/mod.rs | |||
| @@ -214,7 +214,7 @@ impl<'d, T: Instance> Adc<'d, T> { | |||
| 214 | #[cfg(any(adc_g4, adc_v3, adc_g0, adc_h5, adc_h7rs, adc_u0, adc_v4, adc_u5, adc_wba, adc_c0))] | 214 | #[cfg(any(adc_g4, adc_v3, adc_g0, adc_h5, adc_h7rs, adc_u0, adc_v4, adc_u5, adc_wba, adc_c0))] |
| 215 | /// Read one or multiple ADC regular channels using DMA. | 215 | /// Read one or multiple ADC regular channels using DMA. |
| 216 | /// | 216 | /// |
| 217 | /// `sequence` iterator and `readings` must have the same length. | 217 | /// `readings` must have a length that is a multiple of the length of the `sequence` iterator. |
| 218 | /// | 218 | /// |
| 219 | /// Example | 219 | /// Example |
| 220 | /// ```rust,ignore | 220 | /// ```rust,ignore |
| @@ -253,8 +253,8 @@ impl<'d, T: Instance> Adc<'d, T> { | |||
| 253 | ) { | 253 | ) { |
| 254 | assert!(sequence.len() != 0, "Asynchronous read sequence cannot be empty"); | 254 | assert!(sequence.len() != 0, "Asynchronous read sequence cannot be empty"); |
| 255 | assert!( | 255 | assert!( |
| 256 | sequence.len() == readings.len(), | 256 | readings.len() % sequence.len() == 0, |
| 257 | "Sequence length must be equal to readings length" | 257 | "Readings length must be a multiple of sequence length" |
| 258 | ); | 258 | ); |
| 259 | assert!( | 259 | assert!( |
| 260 | sequence.len() <= 16, | 260 | sequence.len() <= 16, |
