aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2024-08-25 13:59:27 +0000
committerGitHub <[email protected]>2024-08-25 13:59:27 +0000
commit1ff1f00d5a1125936d5fd3ba81c0b5c398f4cf33 (patch)
treea54c76c879a6ea407c1579dfcceccf5be99cec5f
parent1cfd5370ac012814b7b386ba9ad8499529bdde4e (diff)
parent87e97fb69d31606456ddbf9e3308364773648929 (diff)
Merge pull request #3282 from elagil/add_sai_is_muted
feat: add function to check if SAI is muted
-rw-r--r--embassy-stm32/src/sai/mod.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/embassy-stm32/src/sai/mod.rs b/embassy-stm32/src/sai/mod.rs
index c48d81b5f..6bf184dd8 100644
--- a/embassy-stm32/src/sai/mod.rs
+++ b/embassy-stm32/src/sai/mod.rs
@@ -987,6 +987,21 @@ impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> {
987 ch.cr2().modify(|w| w.set_mute(value)); 987 ch.cr2().modify(|w| w.set_mute(value));
988 } 988 }
989 989
990 /// Determine the mute state of the receiver.
991 ///
992 /// Clears the mute state flag in the status register.
993 pub fn is_muted(&self) -> Result<bool, Error> {
994 match &self.ring_buffer {
995 RingBuffer::Readable(_) => {
996 let ch = T::REGS.ch(self.sub_block as usize);
997 let mute_state = ch.sr().read().mutedet();
998 ch.clrfr().write(|w| w.set_cmutedet(true));
999 Ok(mute_state)
1000 }
1001 _ => Err(Error::NotAReceiver),
1002 }
1003 }
1004
990 /// Write data to the SAI ringbuffer. 1005 /// Write data to the SAI ringbuffer.
991 /// 1006 ///
992 /// This appends the data to the buffer and returns immediately. The 1007 /// This appends the data to the buffer and returns immediately. The