Struct Channel

Source
#[non_exhaustive]
pub struct Channel<'d, Dm, CH>
where Dm: DriverMode, CH: DmaChannel,
{ pub rx: ChannelRx<'d, Dm, CH::Rx>, pub tx: ChannelTx<'d, Dm, CH::Tx>, }
Available on crate feature unstable only.
Expand description

DMA Channel

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§rx: ChannelRx<'d, Dm, CH::Rx>

RX half of the channel

§tx: ChannelTx<'d, Dm, CH::Tx>

TX half of the channel

Implementations§

Source§

impl<CH: DmaChannel, Dm: DriverMode> Channel<'_, Dm, CH>

Source

pub fn runtime_ensure_compatible<P: DmaEligible>( &self, _peripheral: &PeripheralRef<'_, P>, )

Asserts that the channel is compatible with the given peripheral.

Source§

impl<'d, CH> Channel<'d, Blocking, CH>
where CH: DmaChannel,

Source

pub fn new(channel: impl Peripheral<P = CH>) -> Self

Creates a new DMA channel driver.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Sets the interrupt handler for RX and TX interrupts.

Interrupts are not enabled at the peripheral level here.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn listen(&mut self, interrupts: impl Into<EnumSet<DmaInterrupt>>)

Listen for the given interrupts

Source

pub fn unlisten(&mut self, interrupts: impl Into<EnumSet<DmaInterrupt>>)

Unlisten the given interrupts

Source

pub fn interrupts(&mut self) -> EnumSet<DmaInterrupt>

Gets asserted interrupts

Source

pub fn clear_interrupts(&mut self, interrupts: impl Into<EnumSet<DmaInterrupt>>)

Resets asserted interrupts

Source

pub fn set_priority(&mut self, priority: DmaPriority)

Configure the channel priorities.

Source

pub fn into_async(self) -> Channel<'d, Async, CH>

Converts a blocking channel to an async channel.

Source§

impl<'d, CH> Channel<'d, Async, CH>
where CH: DmaChannel,

Source

pub fn into_blocking(self) -> Channel<'d, Blocking, CH>

Converts an async channel to a blocking channel.

Trait Implementations§

Source§

impl<'d, CH: DmaChannel> From<Channel<'d, Async, CH>> for Channel<'d, Blocking, CH>

Source§

fn from(channel: Channel<'d, Async, CH>) -> Self

Converts to this type from the input type.
Source§

impl<'d, CH: DmaChannel> From<Channel<'d, Blocking, CH>> for Channel<'d, Async, CH>

Source§

fn from(channel: Channel<'d, Blocking, CH>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'d, Dm, CH> Freeze for Channel<'d, Dm, CH>
where <CH as DmaChannel>::Rx: Freeze, <CH as DmaChannel>::Tx: Freeze,

§

impl<'d, Dm, CH> RefUnwindSafe for Channel<'d, Dm, CH>
where <CH as DmaChannel>::Rx: RefUnwindSafe, Dm: RefUnwindSafe, <CH as DmaChannel>::Tx: RefUnwindSafe,

§

impl<'d, Dm, CH> Send for Channel<'d, Dm, CH>
where <CH as DmaChannel>::Rx: Send, Dm: Send, <CH as DmaChannel>::Tx: Send,

§

impl<'d, Dm, CH> Sync for Channel<'d, Dm, CH>
where <CH as DmaChannel>::Rx: Sync, Dm: Sync, <CH as DmaChannel>::Tx: Sync,

§

impl<'d, Dm, CH> Unpin for Channel<'d, Dm, CH>
where <CH as DmaChannel>::Rx: Unpin, Dm: Unpin, <CH as DmaChannel>::Tx: Unpin,

§

impl<'d, Dm, CH> !UnwindSafe for Channel<'d, Dm, CH>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

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

Performs the conversion.