I2S

Struct I2S 

Source
pub struct I2S { /* private fields */ }

Implementations§

Source§

impl I2S

Source

pub fn new(i2s: I2S, pins: Pins) -> I2S

Takes ownership of the raw I2S peripheral, returning a safe wrapper in controller mode.

Source

pub fn enable(&self) -> &I2S

Enables the I2S module.

Source

pub fn disable(&self) -> &I2S

Disables the I2S module.

Source

pub fn start(&self) -> &I2S

Starts I2S transfer.

Source

pub fn stop(&self) -> &I2S

Stops the I2S transfer and waits until it has stopped.

Source

pub fn set_tx_enabled(&self, enabled: bool) -> &I2S

Enables/disables I2S transmission (TX).

Source

pub fn set_rx_enabled(&self, enabled: bool) -> &I2S

Enables/disables I2S reception (RX).

Source

pub fn set_mck_frequency(&self, freq: MckFreq) -> &I2S

Sets MCK generator frequency.

Source

pub fn set_ratio(&self, ratio: Ratio) -> &I2S

Sets MCK / LRCK ratio.

Source

pub fn set_sample_width(&self, width: SampleWidth) -> &I2S

Sets sample width.

Source

pub fn set_align(&self, align: Align) -> &I2S

Sets the sample alignment within a frame.

Source

pub fn set_format(&self, format: Format) -> &I2S

Sets the frame format.

Source

pub fn set_channels(&self, channels: Channels) -> &I2S

Sets the I2S channel configuration.

Source

pub fn channels(&self) -> Channels

Returns the I2S channel configuration.

Source

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.

Source

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.

Source

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.

Source

pub fn set_tx_ptr(&self, addr: u32) -> Result<(), Error>

Sets the transmit buffer RAM start address.

Source

pub unsafe fn set_rx_ptr(&self, addr: u32) -> Result<(), Error>

Sets the receive buffer RAM start address.

§Safety

addr must be the address of writeable static memory of sufficient size to hold the specified receive buffer.

Source

pub unsafe fn set_buffersize(&self, n_32bit: u32) -> Result<(), Error>

Sets the size (in 32bit words) of the receive and transmit buffers.

§Safety

n_32bit must be no longer than the DMA buffer pointed to by this struct.

Source

pub fn is_event_triggered(&self, event: I2SEvent) -> bool

Checks if an event has been triggered.

Source

pub fn reset_event(&self, event: I2SEvent)

Marks event as handled.

Source

pub fn enable_interrupt(&self, event: I2SEvent) -> &I2S

Enables interrupt triggering on the specified event.

Source

pub fn disable_interrupt(&self, event: I2SEvent) -> &I2S

Disables interrupt triggering on the specified event.

Source

pub fn event_stopped(&self) -> &Reg<EVENTS_STOPPED_SPEC>

Returns reference to Stopped event endpoint for PPI.

Source

pub fn event_rx_ptr_updated(&self) -> &Reg<EVENTS_RXPTRUPD_SPEC>

Returns reference to RxPtrUpdated event endpoint for PPI.

Source

pub fn event_tx_ptr_updated(&self) -> &Reg<EVENTS_TXPTRUPD_SPEC>

Returns reference to TxPtrUpdated event endpoint for PPI.

Source

pub fn task_start(&self) -> &Reg<TASKS_START_SPEC>

Returns reference to Start task endpoint for PPI.

Source

pub fn task_stop(&self) -> &Reg<TASKS_STOP_SPEC>

Returns reference to Stop task endpoint for PPI.

Source

pub fn free(self) -> (I2S, Pins)

Consumes self and returns back the raw peripheral.

Auto Trait Implementations§

§

impl Freeze for I2S

§

impl RefUnwindSafe for I2S

§

impl Send for I2S

§

impl !Sync for I2S

§

impl Unpin for I2S

§

impl UnwindSafe for I2S

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.