pub struct Reader<'s, 'd, W: Word>(/* private fields */);Expand description
I2S driver reader. Useful for moving read functionality across tasks.
Implementations§
Source§impl<'s, 'd, W: Word> Reader<'s, 'd, W>
impl<'s, 'd, W: Word> Reader<'s, 'd, W>
Sourcepub async fn read(&mut self, data: &mut [W]) -> Result<(), Error>
pub async fn read(&mut self, data: &mut [W]) -> Result<(), Error>
Read data from the I2S ringbuffer. SAI is always receiving data in the background. This function pops already-received data from the buffer. If there’s less than data.len() data in the buffer, this waits until there is.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the ring buffer to its initial state. Can be used to prevent overrun. The ringbuffer will always auto-reset on Overrun in any case.
NOTE: This only clears the DMA buffer and is not synchronized to WS/LR clock, so the order of channels may or may not be swapped after this. A full restart is required to ensure buffer contents and I2S transmissions are in sync.
Auto Trait Implementations§
impl<'s, 'd, W> Freeze for Reader<'s, 'd, W>
impl<'s, 'd, W> RefUnwindSafe for Reader<'s, 'd, W>where
W: RefUnwindSafe,
impl<'s, 'd, W> Send for Reader<'s, 'd, W>where
W: Send,
impl<'s, 'd, W> Sync for Reader<'s, 'd, W>where
W: Sync,
impl<'s, 'd, W> Unpin for Reader<'s, 'd, W>
impl<'s, 'd, W> !UnwindSafe for Reader<'s, 'd, W>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more