Skip to main content

Channel

Struct Channel 

Source
#[non_exhaustive]
pub struct Channel<Dm, CH>
where Dm: DriverMode, CH: DmaChannel,
{ pub rx: ChannelRx<Dm, CH::Rx>, pub tx: ChannelTx<Dm, CH::Tx>, }
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<Dm, CH::Rx>

RX half of the channel.

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

TX half of the channel.

Implementations§

Source§

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

Source

pub fn new(channel: CH) -> Self

Available on crate feature unstable only.

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)

Available on crate feature unstable only.

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

Listens for the given interrupts.

Source

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

Unlistens from the given interrupts.

Source

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

Returns the 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)

Configures the channel priorities.

Source

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

Converts a blocking channel to an async channel.

Source§

impl<CH, Dm> Channel<Dm, CH>
where CH: DmaChannel, Dm: DriverMode,

Source

pub fn runtime_ensure_compatible(&self, peripheral: DmaPeripheral)

Available on crate feature unstable only.

Asserts that the channel is compatible with the given peripheral.

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

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

Source

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

Converts an async channel to a blocking channel.

Trait Implementations§

Source§

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

Available on crate feature unstable only.
Source§

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

Converts to this type from the input type.
Source§

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

Available on crate feature unstable only.
Source§

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

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<Dm, CH> Freeze for Channel<Dm, CH>
where ChannelRx<Dm, <CH as DmaChannel>::Rx>: Freeze, ChannelTx<Dm, <CH as DmaChannel>::Tx>: Freeze,

§

impl<Dm, CH> RefUnwindSafe for Channel<Dm, CH>
where ChannelRx<Dm, <CH as DmaChannel>::Rx>: RefUnwindSafe, ChannelTx<Dm, <CH as DmaChannel>::Tx>: RefUnwindSafe,

§

impl<Dm, CH> Send for Channel<Dm, CH>
where ChannelRx<Dm, <CH as DmaChannel>::Rx>: Send, ChannelTx<Dm, <CH as DmaChannel>::Tx>: Send,

§

impl<Dm, CH> Sync for Channel<Dm, CH>
where ChannelRx<Dm, <CH as DmaChannel>::Rx>: Sync, ChannelTx<Dm, <CH as DmaChannel>::Tx>: Sync,

§

impl<Dm, CH> Unpin for Channel<Dm, CH>
where ChannelRx<Dm, <CH as DmaChannel>::Rx>: Unpin, ChannelTx<Dm, <CH as DmaChannel>::Tx>: Unpin,

§

impl<Dm, CH> UnsafeUnpin for Channel<Dm, CH>
where ChannelRx<Dm, <CH as DmaChannel>::Rx>: UnsafeUnpin, ChannelTx<Dm, <CH as DmaChannel>::Tx>: UnsafeUnpin,

§

impl<Dm, CH> UnwindSafe for Channel<Dm, CH>
where ChannelRx<Dm, <CH as DmaChannel>::Rx>: UnwindSafe, ChannelTx<Dm, <CH as DmaChannel>::Tx>: UnwindSafe,

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> 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<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<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.