Skip to main content

TxChannel

Struct TxChannel 

Source
pub struct TxChannel<'a, Dm: DriverMode> { /* private fields */ }
Expand description

A transmit channel.

Created by Rmt::tx_channel or Rmt::async_tx_channel. Dropping the channel disconnects the pin and frees the channel singletons.

Implementations§

Source§

impl<'a, Dm: DriverMode> TxChannel<'a, Dm>

Source

pub fn with_pin(self, pin: impl PeripheralOutput<'a>) -> Self

Connects a pin to the channel’s output signal.

This will replace previous pin assignments for this signal.

Source

pub fn apply_config(&mut self, config: &TxConfig) -> Result<(), ConfigError>

Source

pub fn tick_rate(&self) -> Rate

Returns the actual tick rate.

Source

pub fn transmit(&mut self, data: &[PulseCode]) -> Result<(), TxError>

Sends data and blocks until the last code is out.

The driver adds the end marker. A code with a zero length ends the transmission early: the codes after it are not sent. Empty data returns at once.

§Errors

TxError::Underrun if the transmission ended before the driver wrote all data to the channel RAM.

Source

pub fn transmit_loop( &mut self, data: &[PulseCode], mode: LoopMode, ) -> Result<TxLoop<'_>, TxError>

Sends data repeatedly until the returned TxLoop stops.

The driver adds the end marker that ends each repetition. All codes and the end marker must fit in the channel RAM. The mode argument decides whether the transmission repeats until it is stopped or for a number of repetitions, see LoopMode.

§Errors

TxError::DataTooLong, or TxError::LoopCountOutOfRange for a loop count above MAX_TX_LOOPCOUNT.

Source§

impl<'a> TxChannel<'a, Async>

Source

pub async fn transmit_async( &mut self, data: &[PulseCode], ) -> Result<(), TxError>

Sends data and returns when the last code is out.

Dropping the future stops the transmission. See TxChannel::transmit.

§Errors

TxError::Underrun if the task did not refill the channel RAM in time.

Trait Implementations§

Source§

impl<'a, Dm: Debug + DriverMode> Debug for TxChannel<'a, Dm>

Available on crate feature unstable only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Dm: DriverMode> Drop for TxChannel<'_, Dm>

Available on crate feature unstable only.
Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a, Dm> Forget for TxChannel<'a, Dm>

§

impl<'a, Dm> Freeze for TxChannel<'a, Dm>
where PhantomData<Tx>: Freeze, PhantomData<(&'a (), Dm)>: Freeze,

§

impl<'a, Dm> Move for TxChannel<'a, Dm>

§

impl<'a, Dm> RefUnwindSafe for TxChannel<'a, Dm>
where Dm: RefUnwindSafe,

§

impl<'a, Dm> Send for TxChannel<'a, Dm>
where Dm: Send, &'a (): Send,

§

impl<'a, Dm> Sync for TxChannel<'a, Dm>
where Dm: Sync,

§

impl<'a, Dm> Unpin for TxChannel<'a, Dm>
where Dm: Unpin, &'a (): Unpin,

§

impl<'a, Dm> UnsafeUnpin for TxChannel<'a, Dm>
where PhantomData<Tx>: UnsafeUnpin, PhantomData<(&'a (), Dm)>: UnsafeUnpin,

§

impl<'a, Dm> UnwindSafe for TxChannel<'a, Dm>
where &'a (): UnwindSafe, Dm: UnwindSafe,

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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = !

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

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

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.