Skip to main content

RmtChannel

Trait RmtChannel 

Source
pub trait RmtChannel {
    // Required methods
    fn handle(&self) -> rmt_channel_handle_t;
    fn is_enabled(&self) -> bool;

    // Provided methods
    fn enable(&mut self) -> Result<(), EspError> { ... }
    fn disable(&mut self) -> Result<(), EspError> { ... }
    fn apply_carrier(
        &mut self,
        carrier_config: Option<&CarrierConfig>,
    ) -> Result<(), EspError> { ... }
}
Expand description

A trait implemented by an RMT channel that provides common functionality.

Required Methods§

Source

fn handle(&self) -> rmt_channel_handle_t

Returns the underlying rmt_channel_handle_t.

Source

fn is_enabled(&self) -> bool

Returns whether the channel is currently enabled.

Provided Methods§

Source

fn enable(&mut self) -> Result<(), EspError>

Must be called in advance before transmitting or receiving RMT symbols. For TX channels, enabling a channel enables a specific interrupt and prepares the hardware to dispatch transactions.

For RX channels, enabling a channel enables an interrupt, but the receiver is not started during this time, as the characteristics of the incoming signal have yet to be specified.

The receiver is started in [RxChannel::receive].

Source

fn disable(&mut self) -> Result<(), EspError>

Disables the interrupt and clearing any pending interrupts. The transmitter and receiver are disabled as well.

§Note

This function will release a power management (PM) lock that might be installed during channel allocation

§Errors
  • ESP_ERR_INVALID_ARG: Disable RMT channel failed because of invalid argument
  • ESP_ERR_INVALID_STATE: Disable RMT channel failed because it’s not enabled yet
  • ESP_FAIL: Disable RMT channel failed because of other error
Source

fn apply_carrier( &mut self, carrier_config: Option<&CarrierConfig>, ) -> Result<(), EspError>

Apply (de)modulation feature for the channel.

If carrier_config is None, the carrier (de)modulation will be disabled.

§Errors
  • ESP_ERR_INVALID_ARG: Apply carrier failed because of invalid argument
  • ESP_FAIL: Apply carrier failed because of other error

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<R: RmtChannel> RmtChannel for &mut R

Source§

fn handle(&self) -> rmt_channel_handle_t

Source§

fn is_enabled(&self) -> bool

Source§

fn enable(&mut self) -> Result<(), EspError>

Source§

fn disable(&mut self) -> Result<(), EspError>

Source§

fn apply_carrier( &mut self, carrier_config: Option<&CarrierConfig>, ) -> Result<(), EspError>

Implementors§