diff options
| author | xoviat <[email protected]> | 2025-12-16 17:45:09 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-16 17:45:09 +0000 |
| commit | 2701543feb863dfc0038f28e649f7a6633240ef1 (patch) | |
| tree | be82e619918e704a5b21cf80af11ec1f5a47367b | |
| parent | 996a8d74d7a1a67eec528c34407efb0d6f2a20ba (diff) | |
| parent | b9395180fba64d42fb3e0977f4882d7555488c2f (diff) | |
Merge pull request #5086 from yodaldevoid/looping-adc-read-redux
stm32/adc: allow DMA reads to loop through enabled channels
| -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, |
