diff options
| author | Alexandros Liarokapis <[email protected]> | 2024-10-03 13:04:15 +0300 |
|---|---|---|
| committer | Alexandros Liarokapis <[email protected]> | 2024-10-15 12:29:12 +0300 |
| commit | d280b234283d3c65e7ba6087e52005160a538ad2 (patch) | |
| tree | 5c8cfb053a0b2497be9bc7dc5a6f5332c2b78031 | |
| parent | 2ec05da5ddadad9b34c72e8ef1a57a7662a6f0e0 (diff) | |
fix adc/ringbuffered_v2.rs
| -rw-r--r-- | embassy-stm32/src/adc/ringbuffered_v2.rs | 4 | ||||
| -rw-r--r-- | embassy-stm32/src/dma/ringbuffer/mod.rs | 3 | ||||
| -rw-r--r-- | embassy-stm32/src/lib.rs | 3 |
3 files changed, 8 insertions, 2 deletions
diff --git a/embassy-stm32/src/adc/ringbuffered_v2.rs b/embassy-stm32/src/adc/ringbuffered_v2.rs index 9c114e463..3f0c1a57a 100644 --- a/embassy-stm32/src/adc/ringbuffered_v2.rs +++ b/embassy-stm32/src/adc/ringbuffered_v2.rs | |||
| @@ -6,11 +6,13 @@ use embassy_hal_internal::{into_ref, Peripheral}; | |||
| 6 | use stm32_metapac::adc::vals::SampleTime; | 6 | use stm32_metapac::adc::vals::SampleTime; |
| 7 | 7 | ||
| 8 | use crate::adc::{Adc, AdcChannel, Instance, RxDma}; | 8 | use crate::adc::{Adc, AdcChannel, Instance, RxDma}; |
| 9 | use crate::dma::ringbuffer::OverrunError; | ||
| 10 | use crate::dma::{Priority, ReadableRingBuffer, TransferOptions}; | 9 | use crate::dma::{Priority, ReadableRingBuffer, TransferOptions}; |
| 11 | use crate::pac::adc::vals; | 10 | use crate::pac::adc::vals; |
| 12 | use crate::rcc; | 11 | use crate::rcc; |
| 13 | 12 | ||
| 13 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 14 | pub struct OverrunError; | ||
| 15 | |||
| 14 | fn clear_interrupt_flags(r: crate::pac::adc::Adc) { | 16 | fn clear_interrupt_flags(r: crate::pac::adc::Adc) { |
| 15 | r.sr().modify(|regs| { | 17 | r.sr().modify(|regs| { |
| 16 | regs.set_eoc(false); | 18 | regs.set_eoc(false); |
diff --git a/embassy-stm32/src/dma/ringbuffer/mod.rs b/embassy-stm32/src/dma/ringbuffer/mod.rs index ac4be3e18..12d418414 100644 --- a/embassy-stm32/src/dma/ringbuffer/mod.rs +++ b/embassy-stm32/src/dma/ringbuffer/mod.rs | |||
| @@ -119,7 +119,8 @@ impl<'a, W: Word> ReadableDmaRingBuffer<'a, W> { | |||
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | /// Read elements from the ring buffer | 122 | /// Read elements from the ring buffer. |
| 123 | /// | ||
| 123 | /// Return a tuple of the length read and the length remaining in the buffer | 124 | /// Return a tuple of the length read and the length remaining in the buffer |
| 124 | /// If not all of the elements were read, then there will be some elements in the buffer remaining | 125 | /// If not all of the elements were read, then there will be some elements in the buffer remaining |
| 125 | /// The length remaining is the capacity, ring_buf.len(), less the elements remaining after the read | 126 | /// The length remaining is the capacity, ring_buf.len(), less the elements remaining after the read |
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 451f595e0..5f103e652 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs | |||
| @@ -296,6 +296,9 @@ mod dual_core { | |||
| 296 | /// It cannot be initialized by the user. The intended use is: | 296 | /// It cannot be initialized by the user. The intended use is: |
| 297 | /// | 297 | /// |
| 298 | /// ``` | 298 | /// ``` |
| 299 | /// use core::mem::MaybeUninit; | ||
| 300 | /// use embassy_stm32::{init_secondary, SharedData}; | ||
| 301 | /// | ||
| 299 | /// #[link_section = ".ram_d3"] | 302 | /// #[link_section = ".ram_d3"] |
| 300 | /// static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); | 303 | /// static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); |
| 301 | /// | 304 | /// |
