pub struct I2S { /* private fields */ }
Implementations§
Source§impl I2S
impl I2S
Sourcepub fn new(i2s: I2S, pins: Pins) -> I2S
pub fn new(i2s: I2S, pins: Pins) -> I2S
Takes ownership of the raw I2S peripheral, returning a safe wrapper in controller mode.
Sourcepub fn set_tx_enabled(&self, enabled: bool) -> &I2S
pub fn set_tx_enabled(&self, enabled: bool) -> &I2S
Enables/disables I2S transmission (TX).
Sourcepub fn set_rx_enabled(&self, enabled: bool) -> &I2S
pub fn set_rx_enabled(&self, enabled: bool) -> &I2S
Enables/disables I2S reception (RX).
Sourcepub fn set_mck_frequency(&self, freq: MckFreq) -> &I2S
pub fn set_mck_frequency(&self, freq: MckFreq) -> &I2S
Sets MCK generator frequency.
Sourcepub fn set_sample_width(&self, width: SampleWidth) -> &I2S
pub fn set_sample_width(&self, width: SampleWidth) -> &I2S
Sets sample width.
Sourcepub fn set_format(&self, format: Format) -> &I2S
pub fn set_format(&self, format: Format) -> &I2S
Sets the frame format.
Sourcepub fn set_channels(&self, channels: Channels) -> &I2S
pub fn set_channels(&self, channels: Channels) -> &I2S
Sets the I2S channel configuration.
Sourcepub fn rx<W, B>(self, buffer: B) -> Result<Transfer<B>, Error>where
W: SupportedWordSize,
B: WriteBuffer<Word = W> + 'static,
pub fn rx<W, B>(self, buffer: B) -> Result<Transfer<B>, Error>where
W: SupportedWordSize,
B: WriteBuffer<Word = W> + 'static,
Receives data into the given buffer
until it’s filled.
Buffer address must be 4 byte aligned and located in RAM.
Returns a value that represents the in-progress DMA transfer.
Sourcepub fn transfer<W, TxB, RxB>(
self,
tx_buffer: TxB,
rx_buffer: RxB,
) -> Result<TransferFullDuplex<TxB, RxB>, Error>where
W: SupportedWordSize,
TxB: ReadBuffer<Word = W> + 'static,
RxB: WriteBuffer<Word = W> + 'static,
pub fn transfer<W, TxB, RxB>(
self,
tx_buffer: TxB,
rx_buffer: RxB,
) -> Result<TransferFullDuplex<TxB, RxB>, Error>where
W: SupportedWordSize,
TxB: ReadBuffer<Word = W> + 'static,
RxB: WriteBuffer<Word = W> + 'static,
Full duplex DMA transfer.
Transmits the given tx_buffer
while simultaneously receiving data
into the given rx_buffer
until it is filled.
The buffers must be of equal size and their addresses must be 4 byte aligned and located in RAM.
Returns a value that represents the in-progress DMA transfer.
Sourcepub fn tx<W, B>(self, buffer: B) -> Result<Transfer<B>, Error>where
W: SupportedWordSize,
B: ReadBuffer<Word = W> + 'static,
pub fn tx<W, B>(self, buffer: B) -> Result<Transfer<B>, Error>where
W: SupportedWordSize,
B: ReadBuffer<Word = W> + 'static,
Transmits the given tx_buffer
.
Buffer address must be 4 byte aligned and located in RAM.
Returns a value that represents the in-progress DMA transfer.
Sourcepub fn set_tx_ptr(&self, addr: u32) -> Result<(), Error>
pub fn set_tx_ptr(&self, addr: u32) -> Result<(), Error>
Sets the transmit buffer RAM start address.
Sourcepub unsafe fn set_rx_ptr(&self, addr: u32) -> Result<(), Error>
pub unsafe fn set_rx_ptr(&self, addr: u32) -> Result<(), Error>
Sets the receive buffer RAM start address.
Sourcepub unsafe fn set_buffersize(&self, n_32bit: u32) -> Result<(), Error>
pub unsafe fn set_buffersize(&self, n_32bit: u32) -> Result<(), Error>
Sets the size (in 32bit words) of the receive and transmit buffers.
Sourcepub fn is_event_triggered(&self, event: I2SEvent) -> bool
pub fn is_event_triggered(&self, event: I2SEvent) -> bool
Checks if an event has been triggered.
Sourcepub fn reset_event(&self, event: I2SEvent)
pub fn reset_event(&self, event: I2SEvent)
Marks event as handled.
Sourcepub fn enable_interrupt(&self, event: I2SEvent) -> &I2S
pub fn enable_interrupt(&self, event: I2SEvent) -> &I2S
Enables interrupt triggering on the specified event.
Sourcepub fn disable_interrupt(&self, event: I2SEvent) -> &I2S
pub fn disable_interrupt(&self, event: I2SEvent) -> &I2S
Disables interrupt triggering on the specified event.
Sourcepub fn event_stopped(&self) -> &Reg<EVENTS_STOPPED_SPEC>
pub fn event_stopped(&self) -> &Reg<EVENTS_STOPPED_SPEC>
Returns reference to Stopped
event endpoint for PPI.
Sourcepub fn event_rx_ptr_updated(&self) -> &Reg<EVENTS_RXPTRUPD_SPEC>
pub fn event_rx_ptr_updated(&self) -> &Reg<EVENTS_RXPTRUPD_SPEC>
Returns reference to RxPtrUpdated
event endpoint for PPI.
Sourcepub fn event_tx_ptr_updated(&self) -> &Reg<EVENTS_TXPTRUPD_SPEC>
pub fn event_tx_ptr_updated(&self) -> &Reg<EVENTS_TXPTRUPD_SPEC>
Returns reference to TxPtrUpdated
event endpoint for PPI.
Sourcepub fn task_start(&self) -> &Reg<TASKS_START_SPEC>
pub fn task_start(&self) -> &Reg<TASKS_START_SPEC>
Returns reference to Start
task endpoint for PPI.
Sourcepub fn task_stop(&self) -> &Reg<TASKS_STOP_SPEC>
pub fn task_stop(&self) -> &Reg<TASKS_STOP_SPEC>
Returns reference to Stop
task endpoint for PPI.