diff options
| author | elagil <[email protected]> | 2025-08-25 21:10:59 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-09-05 14:43:29 +0200 |
| commit | 3c3b43fb00355a5db64a34416dc2f19042a3fc5a (patch) | |
| tree | f3cfef9a81d56f6e86524bd83a7df6ea8d386749 /embassy-stm32/src/sai | |
| parent | 70aaa82e490a8c5637de7e38cb636f04c1d187f7 (diff) | |
feat: GPDAM linked-list + ringbuffer support
Diffstat (limited to 'embassy-stm32/src/sai')
| -rw-r--r-- | embassy-stm32/src/sai/mod.rs | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/embassy-stm32/src/sai/mod.rs b/embassy-stm32/src/sai/mod.rs index 4965f8b04..88cc225dd 100644 --- a/embassy-stm32/src/sai/mod.rs +++ b/embassy-stm32/src/sai/mod.rs | |||
| @@ -1,13 +1,11 @@ | |||
| 1 | //! Serial Audio Interface (SAI) | 1 | //! Serial Audio Interface (SAI) |
| 2 | #![macro_use] | 2 | #![macro_use] |
| 3 | #![cfg_attr(gpdma, allow(unused))] | ||
| 4 | 3 | ||
| 5 | use core::marker::PhantomData; | 4 | use core::marker::PhantomData; |
| 6 | 5 | ||
| 7 | use embassy_hal_internal::PeripheralType; | 6 | use embassy_hal_internal::PeripheralType; |
| 8 | 7 | ||
| 9 | pub use crate::dma::word; | 8 | pub use crate::dma::word; |
| 10 | #[cfg(not(gpdma))] | ||
| 11 | use crate::dma::{ringbuffer, Channel, ReadableRingBuffer, Request, TransferOptions, WritableRingBuffer}; | 9 | use crate::dma::{ringbuffer, Channel, ReadableRingBuffer, Request, TransferOptions, WritableRingBuffer}; |
| 12 | use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; | 10 | use crate::gpio::{AfType, AnyPin, OutputType, Pull, SealedPin as _, Speed}; |
| 13 | use crate::pac::sai::{vals, Sai as Regs}; | 11 | use crate::pac::sai::{vals, Sai as Regs}; |
| @@ -26,7 +24,6 @@ pub enum Error { | |||
| 26 | Overrun, | 24 | Overrun, |
| 27 | } | 25 | } |
| 28 | 26 | ||
| 29 | #[cfg(not(gpdma))] | ||
| 30 | impl From<ringbuffer::Error> for Error { | 27 | impl From<ringbuffer::Error> for Error { |
| 31 | fn from(#[allow(unused)] err: ringbuffer::Error) -> Self { | 28 | fn from(#[allow(unused)] err: ringbuffer::Error) -> Self { |
| 32 | #[cfg(feature = "defmt")] | 29 | #[cfg(feature = "defmt")] |
| @@ -652,7 +649,6 @@ impl Config { | |||
| 652 | } | 649 | } |
| 653 | } | 650 | } |
| 654 | 651 | ||
| 655 | #[cfg(not(gpdma))] | ||
| 656 | enum RingBuffer<'d, W: word::Word> { | 652 | enum RingBuffer<'d, W: word::Word> { |
| 657 | Writable(WritableRingBuffer<'d, W>), | 653 | Writable(WritableRingBuffer<'d, W>), |
| 658 | Readable(ReadableRingBuffer<'d, W>), | 654 | Readable(ReadableRingBuffer<'d, W>), |
| @@ -679,7 +675,6 @@ fn get_af_types(mode: Mode, tx_rx: TxRx) -> (AfType, AfType) { | |||
| 679 | ) | 675 | ) |
| 680 | } | 676 | } |
| 681 | 677 | ||
| 682 | #[cfg(not(gpdma))] | ||
| 683 | fn get_ring_buffer<'d, T: Instance, W: word::Word>( | 678 | fn get_ring_buffer<'d, T: Instance, W: word::Word>( |
| 684 | dma: Peri<'d, impl Channel>, | 679 | dma: Peri<'d, impl Channel>, |
| 685 | dma_buf: &'d mut [W], | 680 | dma_buf: &'d mut [W], |
| @@ -750,14 +745,10 @@ pub struct Sai<'d, T: Instance, W: word::Word> { | |||
| 750 | fs: Option<Peri<'d, AnyPin>>, | 745 | fs: Option<Peri<'d, AnyPin>>, |
| 751 | sck: Option<Peri<'d, AnyPin>>, | 746 | sck: Option<Peri<'d, AnyPin>>, |
| 752 | mclk: Option<Peri<'d, AnyPin>>, | 747 | mclk: Option<Peri<'d, AnyPin>>, |
| 753 | #[cfg(gpdma)] | ||
| 754 | ring_buffer: PhantomData<W>, | ||
| 755 | #[cfg(not(gpdma))] | ||
| 756 | ring_buffer: RingBuffer<'d, W>, | 748 | ring_buffer: RingBuffer<'d, W>, |
| 757 | sub_block: WhichSubBlock, | 749 | sub_block: WhichSubBlock, |
| 758 | } | 750 | } |
| 759 | 751 | ||
| 760 | #[cfg(not(gpdma))] | ||
| 761 | impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> { | 752 | impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> { |
| 762 | /// Create a new SAI driver in asynchronous mode with MCLK. | 753 | /// Create a new SAI driver in asynchronous mode with MCLK. |
| 763 | /// | 754 | /// |
