Struct nrf52840_hal::i2s::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.

source

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

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

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 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

§

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>,

§

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>,

§

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.