mirror of
https://github.com/esphome/esphome.git
synced 2025-02-16 01:41:42 +01:00
Cleanup transmitter
This commit is contained in:
parent
f18ff4b533
commit
de7f07aa25
@ -28,14 +28,13 @@ void RemoteTransmitterComponent::dump_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RemoteTransmitterComponent::configure_rmt_() {
|
void RemoteTransmitterComponent::configure_rmt_() {
|
||||||
esp_err_t error;
|
rmt_tx_channel_config_t channel{};
|
||||||
rmt_tx_channel_config_t config{};
|
channel.clk_src = RMT_CLK_SRC_DEFAULT;
|
||||||
config.clk_src = RMT_CLK_SRC_DEFAULT;
|
channel.resolution_hz = 1 * 1000 * 1000;
|
||||||
config.resolution_hz = 1 * 1000 * 1000;
|
channel.gpio_num = gpio_num_t(this->pin_->get_pin());
|
||||||
config.gpio_num = gpio_num_t(this->pin_->get_pin());
|
channel.mem_block_symbols = 64 * this->mem_block_num_;
|
||||||
config.mem_block_symbols = 64 * this->mem_block_num_;
|
channel.trans_queue_depth = 1;
|
||||||
config.trans_queue_depth = 1;
|
esp_err_t error = rmt_new_tx_channel(&channel, &this->channel_);
|
||||||
error = rmt_new_tx_channel(&config, &this->channel_);
|
|
||||||
if (error != ESP_OK) {
|
if (error != ESP_OK) {
|
||||||
this->error_code_ = error;
|
this->error_code_ = error;
|
||||||
this->error_string_ = "in rmt_new_tx_channel";
|
this->error_string_ = "in rmt_new_tx_channel";
|
||||||
@ -55,7 +54,7 @@ void RemoteTransmitterComponent::configure_rmt_() {
|
|||||||
rmt_carrier_config_t carrier{};
|
rmt_carrier_config_t carrier{};
|
||||||
if (this->current_carrier_frequency_ == 0 || this->carrier_duty_percent_ == 100) {
|
if (this->current_carrier_frequency_ == 0 || this->carrier_duty_percent_ == 100) {
|
||||||
carrier.frequency_hz = 0;
|
carrier.frequency_hz = 0;
|
||||||
carrier.duty_cycle = 100.0f;
|
carrier.duty_cycle = 100;
|
||||||
} else {
|
} else {
|
||||||
carrier.frequency_hz = this->current_carrier_frequency_;
|
carrier.frequency_hz = this->current_carrier_frequency_;
|
||||||
carrier.duty_cycle = this->carrier_duty_percent_;
|
carrier.duty_cycle = this->carrier_duty_percent_;
|
||||||
|
Loading…
Reference in New Issue
Block a user