Struct stm32_hal2::sai::Sai [−][src]
pub struct Sai<R> {
pub regs: R,
// some fields omitted
}
Expand description
Represents the Serial Audio Interface (SAI) peripheral, used for digital audio input and output.
Fields
regs: R
Implementations
Initialize a SAI peripheral, including enabling and resetting its RCC peripheral clock.
Enable an audio subblock (channel).
Disable an audio subblock (channel). See H743 RM, section 51.4.15. The SAI audio block can be disabled at any moment by clearing SAIEN bit in the SAI_xCR1 register. All the already started frames are automatically completed before the SAI is stops working. SAIEN bit remains High until the SAI is completely switched-off at the end of the current audio frame transfer. If an audio block in the SAI operates synchronously with the other one, the one which is the master must be disabled first.
Read a word of data.
Send 2 words of data to a single channel: Left and right channel, in that order. A write to the SR register loads the FIFO provided the FIFO is not full.
pub unsafe fn write_dma<D>(
&mut self,
buf: &[u32],
sai_channel: SaiChannel,
dma_channel: DmaChannel,
channel_cfg: ChannelCfg,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
pub unsafe fn write_dma<D>(
&mut self,
buf: &[u32],
sai_channel: SaiChannel,
dma_channel: DmaChannel,
channel_cfg: ChannelCfg,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
Send data over SAI with DMA. H743 RM, section 51.4.16: SAI DMA Interface. To free the CPU and to optimize bus bandwidth, each SAI audio block has an independent DMA interface to read/write from/to the SAI_xDR register (to access the internal FIFO). There is one DMA channel per audio subblock supporting basic DMA request/acknowledge protocol. Before configuring the SAI block, the SAI DMA channel must be disabled.
pub unsafe fn read_dma<D>(
&mut self,
buf: &mut [u32],
sai_channel: SaiChannel,
dma_channel: DmaChannel,
channel_cfg: ChannelCfg,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
pub unsafe fn read_dma<D>(
&mut self,
buf: &mut [u32],
sai_channel: SaiChannel,
dma_channel: DmaChannel,
channel_cfg: ChannelCfg,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
Read data from SAI with DMA. H743 RM, section 51.4.16: SAI DMA Interface. To free the CPU and to optimize bus bandwidth, each SAI audio block has an independent DMA interface to read/write from/to the SAI_xDR register (to access the internal FIFO). There is one DMA channel per audio subblock supporting basic DMA request/acknowledge protocol.
Enable a specific type of interrupt. See L4 RM, Table 220: “SAI interrupt sources”.
Clears the interrupt pending flag for a specific type of interrupt.