mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
fix: flush SAI FIFO on init
This commit is contained in:
parent
4692f06c33
commit
edb9b03dee
@ -861,12 +861,15 @@ impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> {
|
|||||||
ring_buffer: RingBuffer<'d, W>,
|
ring_buffer: RingBuffer<'d, W>,
|
||||||
config: Config,
|
config: Config,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
let ch = T::REGS.ch(sub_block as usize);
|
||||||
|
|
||||||
#[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
|
#[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
|
||||||
{
|
{
|
||||||
let ch = T::REGS.ch(sub_block as usize);
|
|
||||||
ch.cr1().modify(|w| w.set_saien(false));
|
ch.cr1().modify(|w| w.set_saien(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ch.cr2().modify(|w| w.set_fflush(true));
|
||||||
|
|
||||||
#[cfg(any(sai_v4_2pdm, sai_v4_4pdm))]
|
#[cfg(any(sai_v4_2pdm, sai_v4_4pdm))]
|
||||||
{
|
{
|
||||||
if let SyncInput::External(i) = config.sync_input {
|
if let SyncInput::External(i) = config.sync_input {
|
||||||
@ -888,7 +891,6 @@ impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> {
|
|||||||
|
|
||||||
#[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
|
#[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
|
||||||
{
|
{
|
||||||
let ch = T::REGS.ch(sub_block as usize);
|
|
||||||
ch.cr1().modify(|w| {
|
ch.cr1().modify(|w| {
|
||||||
w.set_mode(config.mode.mode(if Self::is_transmitter(&ring_buffer) {
|
w.set_mode(config.mode.mode(if Self::is_transmitter(&ring_buffer) {
|
||||||
TxRx::Transmitter
|
TxRx::Transmitter
|
||||||
|
Loading…
Reference in New Issue
Block a user