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§
Sourcefn handle(&self) -> rmt_channel_handle_t
fn handle(&self) -> rmt_channel_handle_t
Returns the underlying rmt_channel_handle_t.
Sourcefn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Returns whether the channel is currently enabled.
Provided Methods§
Sourcefn enable(&mut self) -> Result<(), EspError>
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].
Sourcefn disable(&mut self) -> Result<(), EspError>
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 argumentESP_ERR_INVALID_STATE: Disable RMT channel failed because it’s not enabled yetESP_FAIL: Disable RMT channel failed because of other error
Sourcefn apply_carrier(
&mut self,
carrier_config: Option<&CarrierConfig>,
) -> Result<(), EspError>
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 argumentESP_FAIL: Apply carrier failed because of other error