mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-28 17:52:28 +00:00
Merge pull request #3282 from elagil/add_sai_is_muted
feat: add function to check if SAI is muted
This commit is contained in:
commit
1ff1f00d5a
@ -987,6 +987,21 @@ impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> {
|
|||||||
ch.cr2().modify(|w| w.set_mute(value));
|
ch.cr2().modify(|w| w.set_mute(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Determine the mute state of the receiver.
|
||||||
|
///
|
||||||
|
/// Clears the mute state flag in the status register.
|
||||||
|
pub fn is_muted(&self) -> Result<bool, Error> {
|
||||||
|
match &self.ring_buffer {
|
||||||
|
RingBuffer::Readable(_) => {
|
||||||
|
let ch = T::REGS.ch(self.sub_block as usize);
|
||||||
|
let mute_state = ch.sr().read().mutedet();
|
||||||
|
ch.clrfr().write(|w| w.set_cmutedet(true));
|
||||||
|
Ok(mute_state)
|
||||||
|
}
|
||||||
|
_ => Err(Error::NotAReceiver),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Write data to the SAI ringbuffer.
|
/// Write data to the SAI ringbuffer.
|
||||||
///
|
///
|
||||||
/// This appends the data to the buffer and returns immediately. The
|
/// This appends the data to the buffer and returns immediately. The
|
||||||
|
Loading…
Reference in New Issue
Block a user