diff options
| -rw-r--r-- | embassy-stm32/src/sai/mod.rs | 15 |
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 |
