pub struct Rmt<'d, Dm: DriverMode = Blocking> { /* private fields */ }Expand description
Shared RMT setup: clock source and group clock.
Channels come from Rmt::tx_channel and Rmt::rx_channel and borrow the Rmt. The
driver mode decides who owns the RMT interrupt: the user in blocking mode
(Rmt::set_interrupt_handler), the driver in async mode.
Implementations§
Source§impl<'d> Rmt<'d, Blocking>
impl<'d> Rmt<'d, Blocking>
Sourcepub fn new(peripheral: RMT<'d>, config: RmtConfig) -> Result<Self, ConfigError>
pub fn new(peripheral: RMT<'d>, config: RmtConfig) -> Result<Self, ConfigError>
Creates the RMT driver and configures the group clock.
§Errors
None at the moment: an unreachable group frequency selects the nearest one.
Sourcepub fn into_async(self) -> Rmt<'d, Async>
pub fn into_async(self) -> Rmt<'d, Async>
Binds the driver’s interrupt handler, which serves the async channels.
Sourcepub fn set_interrupt_handler(&mut self, handler: InterruptHandler)
pub fn set_interrupt_handler(&mut self, handler: InterruptHandler)
Registers an interrupt handler for the RMT peripheral.
Replaces any previously registered interrupt handlers. Needs &mut self, so it is only
possible while no channel borrows this Rmt.
Source§impl<'d> Rmt<'d, Async>
impl<'d> Rmt<'d, Async>
Sourcepub fn into_blocking(self) -> Rmt<'d, Blocking>
pub fn into_blocking(self) -> Rmt<'d, Blocking>
Unbinds the driver’s interrupt handler.
Sourcepub fn async_tx_channel<'a>(
&'a self,
channel: impl TxInstance + 'a,
config: TxConfig,
) -> Result<TxChannel<'a, Async>, ConfigError>
pub fn async_tx_channel<'a>( &'a self, channel: impl TxInstance + 'a, config: TxConfig, ) -> Result<TxChannel<'a, Async>, ConfigError>
Sourcepub fn async_rx_channel<'a>(
&'a self,
channel: impl RxInstance + 'a,
config: RxConfig,
) -> Result<RxChannel<'a, Async>, ConfigError>
pub fn async_rx_channel<'a>( &'a self, channel: impl RxInstance + 'a, config: RxConfig, ) -> Result<RxChannel<'a, Async>, ConfigError>
Source§impl<'d, Dm: DriverMode> Rmt<'d, Dm>
impl<'d, Dm: DriverMode> Rmt<'d, Dm>
Sourcepub fn apply_config(&mut self, config: &RmtConfig) -> Result<(), ConfigError>
pub fn apply_config(&mut self, config: &RmtConfig) -> Result<(), ConfigError>
Sourcepub fn frequency(&self) -> Rate
pub fn frequency(&self) -> Rate
Returns the actual group clock frequency.
The channel tick rates are this frequency divided by the channel dividers.
Sourcepub fn tx_channel<'a>(
&'a self,
channel: impl TxInstance + 'a,
config: TxConfig,
) -> Result<TxChannel<'a, Blocking>, ConfigError>
pub fn tx_channel<'a>( &'a self, channel: impl TxInstance + 'a, config: TxConfig, ) -> Result<TxChannel<'a, Blocking>, ConfigError>
Creates a blocking transmit channel that uses the group clock of this Rmt.
channel is a channel singleton, or a tuple of adjacent singletons for more RAM (see
TxInstance).
§Errors
ConfigError::UnreachableTickRate or ConfigError::UnreachableCarrier.
Sourcepub fn rx_channel<'a>(
&'a self,
channel: impl RxInstance + 'a,
config: RxConfig,
) -> Result<RxChannel<'a, Blocking>, ConfigError>
pub fn rx_channel<'a>( &'a self, channel: impl RxInstance + 'a, config: RxConfig, ) -> Result<RxChannel<'a, Blocking>, ConfigError>
Creates a blocking receive channel that uses the group clock of this Rmt.
channel is a channel singleton, or a tuple of adjacent singletons for more RAM (see
RxInstance).
§Errors
ConfigError::UnreachableTickRate, ConfigError::UnreachableCarrier or
ConfigError::RxLimitOutOfRange.
Trait Implementations§
Source§impl<'d, Dm: Debug + DriverMode> Debug for Rmt<'d, Dm>
Available on crate feature unstable only.
impl<'d, Dm: Debug + DriverMode> Debug for Rmt<'d, Dm>
unstable only.Source§impl InterruptConfigurable for Rmt<'_, Blocking>
Available on crate feature unstable only.
impl InterruptConfigurable for Rmt<'_, Blocking>
unstable only.