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>
impl<'a, Dm: DriverMode> TxChannel<'a, Dm>
Sourcepub fn with_pin(self, pin: impl PeripheralOutput<'a>) -> Self
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.
Sourcepub fn apply_config(&mut self, config: &TxConfig) -> Result<(), ConfigError>
pub fn apply_config(&mut self, config: &TxConfig) -> Result<(), ConfigError>
Changes the configuration.
§Errors
ConfigError::UnreachableTickRate or ConfigError::UnreachableCarrier.
Sourcepub fn transmit(&mut self, data: &[PulseCode]) -> Result<(), TxError>
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.
Sourcepub fn transmit_loop(
&mut self,
data: &[PulseCode],
mode: LoopMode,
) -> Result<TxLoop<'_>, TxError>
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>
impl<'a> TxChannel<'a, Async>
Sourcepub async fn transmit_async(
&mut self,
data: &[PulseCode],
) -> Result<(), TxError>
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.
impl<'a, Dm: Debug + DriverMode> Debug for TxChannel<'a, Dm>
unstable only.Source§impl<Dm: DriverMode> Drop for TxChannel<'_, Dm>
Available on crate feature unstable only.
impl<Dm: DriverMode> Drop for TxChannel<'_, Dm>
unstable only.