Struct microbit::hal::i2s::I2S[][src]

pub struct I2S { /* fields omitted */ }

Implementations

impl I2S[src]

pub fn new_controller(
    i2s: I2S,
    mck_pin: Option<&Pin<Output<PushPull>>>,
    sck_pin: &Pin<Output<PushPull>>,
    lrck_pin: &Pin<Output<PushPull>>,
    sdin_pin: Option<&Pin<Input<Floating>>>,
    sdout_pin: Option<&Pin<Output<PushPull>>>
) -> I2S
[src]

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

pub fn new_peripheral(
    i2s: I2S,
    mck_pin: Option<&Pin<Input<Floating>>>,
    sck_pin: &Pin<Input<Floating>>,
    lrck_pin: &Pin<Input<Floating>>,
    sdin_pin: Option<&Pin<Input<Floating>>>,
    sdout_pin: Option<&Pin<Output<PushPull>>>
) -> I2S
[src]

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

pub fn enable(&self) -> &I2S[src]

Enables the I2S module.

pub fn disable(&self) -> &I2S[src]

Disables the I2S module.

pub fn start(&self) -> &I2S[src]

Starts I2S transfer.

pub fn stop(&self) -> &I2S[src]

Stops the I2S transfer and waits until it has stopped.

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

Enables/disables I2S transmission (TX).

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

Enables/disables I2S reception (RX).

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

Sets MCK generator frequency.

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

Sets MCK / LRCK ratio.

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

Sets sample width.

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

Sets the sample alignment within a frame.

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

Sets the frame format.

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

Sets the I2S channel configuation.

pub fn channels(&self) -> Channels[src]

Returns the I2S channel configuation.

pub fn rx<W, B>(self, buffer: B) -> Result<Transfer<B>, Error> where
    W: SupportedWordSize,
    B: WriteBuffer<Word = W> + 'static, 
[src]

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.

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, 
[src]

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.

pub fn tx<W, B>(self, buffer: B) -> Result<Transfer<B>, Error> where
    W: SupportedWordSize,
    B: ReadBuffer<Word = W> + 'static, 
[src]

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.

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

Sets the transmit buffer RAM start address.

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

Sets the receive buffer RAM start address.

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

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

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

Checks if an event has been triggered.

pub fn reset_event(&self, event: I2SEvent)[src]

Marks event as handled.

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

Enables interrupt triggering on the specified event.

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

Disables interrupt triggering on the specified event.

pub fn event_stopped(&self) -> &Reg<u32, _EVENTS_STOPPED>[src]

Returns reference to Stopped event endpoint for PPI.

pub fn event_rx_ptr_updated(&self) -> &Reg<u32, _EVENTS_RXPTRUPD>[src]

Returns reference to RxPtrUpdated event endpoint for PPI.

pub fn event_tx_ptr_updated(&self) -> &Reg<u32, _EVENTS_TXPTRUPD>[src]

Returns reference to TxPtrUpdated event endpoint for PPI.

pub fn task_start(&self) -> &Reg<u32, _TASKS_START>[src]

Returns reference to Start task endpoint for PPI.

pub fn task_stop(&self) -> &Reg<u32, _TASKS_STOP>[src]

Returns reference to Stop task endpoint for PPI.

pub fn free(self) -> I2S[src]

Consumes self and returns back the raw peripheral.

Auto Trait Implementations

impl Send for I2S

impl !Sync for I2S

impl Unpin for I2S

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Az for T[src]

pub fn az<Dst>(self) -> Dst where
    T: Cast<Dst>, 
[src]

Casts the value.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> CheckedAs for T[src]

pub fn checked_as<Dst>(self) -> Option<Dst> where
    T: CheckedCast<Dst>, 
[src]

Casts the value.

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<Src, Dst> LosslessTryInto<Dst> for Src where
    Dst: LosslessTryFrom<Src>, 
[src]

pub fn lossless_try_into(self) -> Option<Dst>[src]

Performs the conversion.

impl<Src, Dst> LossyInto<Dst> for Src where
    Dst: LossyFrom<Src>, 
[src]

pub fn lossy_into(self) -> Dst[src]

Performs the conversion.

impl<T> OverflowingAs for T[src]

pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
    T: OverflowingCast<Dst>, 
[src]

Casts the value.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatingAs for T[src]

pub fn saturating_as<Dst>(self) -> Dst where
    T: SaturatingCast<Dst>, 
[src]

Casts the value.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T> UnwrappedAs for T[src]

pub fn unwrapped_as<Dst>(self) -> Dst where
    T: UnwrappedCast<Dst>, 
[src]

Casts the value.

impl<T> WrappingAs for T[src]

pub fn wrapping_as<Dst>(self) -> Dst where
    T: WrappingCast<Dst>, 
[src]

Casts the value.