37 rmt_symbol_word_t symbol = {
43 rmt_transmit_config_t config;
44 memset(&config, 0,
sizeof(config));
45 config.loop_count = 0;
46 config.flags.eot_level = value;
47 esp_err_t error = rmt_transmit(this->
channel_, this->
encoder_, &symbol,
sizeof(symbol), &config);
48 if (error != ESP_OK) {
49 ESP_LOGW(TAG,
"rmt_transmit failed: %s", esp_err_to_name(error));
52 error = rmt_tx_wait_all_done(this->
channel_, -1);
53 if (error != ESP_OK) {
54 ESP_LOGW(TAG,
"rmt_tx_wait_all_done failed: %s", esp_err_to_name(error));
64 rmt_tx_channel_config_t channel;
65 memset(&channel, 0,
sizeof(channel));
66 channel.clk_src = RMT_CLK_SRC_DEFAULT;
68 channel.gpio_num = gpio_num_t(this->
pin_->
get_pin());
70 channel.trans_queue_depth = 1;
71 channel.flags.io_loop_back = open_drain;
72 channel.flags.io_od_mode = open_drain;
73 channel.flags.invert_out = 0;
75 channel.intr_priority = 0;
76 error = rmt_new_tx_channel(&channel, &this->
channel_);
77 if (error != ESP_OK) {
79 if (error == ESP_ERR_NOT_FOUND) {
93 rmt_copy_encoder_config_t encoder;
94 memset(&encoder, 0,
sizeof(encoder));
95 error = rmt_new_copy_encoder(&encoder, &this->
encoder_);
96 if (error != ESP_OK) {
104 if (error != ESP_OK) {
115 error = rmt_apply_carrier(this->
channel_,
nullptr);
117 rmt_carrier_config_t carrier;
118 memset(&carrier, 0,
sizeof(carrier));
121 carrier.flags.polarity_active_low = this->
inverted_;
122 carrier.flags.always_on = 1;
123 error = rmt_apply_carrier(this->
channel_, &carrier);
125 if (error != ESP_OK) {
145 rmt_symbol_word_t rmt_item;
148 bool level =
val >= 0;
154 int32_t item = std::min(
val, int32_t(32767));
157 if (rmt_i % 2 == 0) {
158 rmt_item.level0 =
static_cast<uint32_t
>(level ^ this->
inverted_);
159 rmt_item.duration0 =
static_cast<uint32_t
>(item);
161 rmt_item.level1 =
static_cast<uint32_t
>(level ^ this->
inverted_);
162 rmt_item.duration1 =
static_cast<uint32_t
>(item);
169 if (rmt_i % 2 == 1) {
171 rmt_item.duration1 = 0;
175 if ((this->
rmt_temp_.data() ==
nullptr) || this->rmt_temp_.empty()) {
176 ESP_LOGE(TAG,
"Empty data");
180 for (uint32_t i = 0; i < send_times; i++) {
181 rmt_transmit_config_t config;
182 memset(&config, 0,
sizeof(config));
183 config.loop_count = 0;
186 this->rmt_temp_.size() *
sizeof(rmt_symbol_word_t), &config);
187 if (error != ESP_OK) {
188 ESP_LOGW(TAG,
"rmt_transmit failed: %s", esp_err_to_name(error));
193 error = rmt_tx_wait_all_done(this->
channel_, -1);
194 if (error != ESP_OK) {
195 ESP_LOGW(TAG,
"rmt_tx_wait_all_done failed: %s", esp_err_to_name(error));
198 if (i + 1 < send_times)