27 esp_clk_tree_src_get_freq_hz((soc_module_clk_t) RMT_CLK_SRC_DEFAULT, ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, &freq);
77#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
87 const uint32_t resolution_hz = rmt_resolution_hz();
90 this->params_.bit1.duration0 + this->params_.bit1.duration1);
91 uint64_t frame_ticks = (uint64_t) bit_ticks * buffer_size * RMT_SYMBOLS_PER_BYTE + this->
params_.
reset.duration0 +
92 this->params_.reset.duration1;
93 this->
frame_time_us_ = frame_ticks * 1000000 / resolution_hz + RESET_GAP_US;
97 rmt_tx_channel_config_t channel;
98 memset(&channel, 0,
sizeof(channel));
99 channel.clk_src = RMT_CLK_SRC_DEFAULT;
100 channel.resolution_hz = resolution_hz;
101 channel.gpio_num = gpio_num_t(this->
pin_);
103 channel.trans_queue_depth = 1;
105 channel.flags.with_dma = this->
use_dma_;
106 channel.intr_priority = 0;
107 if (rmt_new_tx_channel(&channel, &this->
channel_) != ESP_OK) {
108 this->
mark_failed(LOG_STR(
"Channel creation failed"));
112#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
113 rmt_simple_encoder_config_t encoder;
114 memset(&encoder, 0,
sizeof(encoder));
115 encoder.callback = encoder_callback;
117 encoder.min_chunk_size = RMT_SYMBOLS_PER_BYTE;
118 if (rmt_new_simple_encoder(&encoder, &this->
encoder_) != ESP_OK) {
119 this->
mark_failed(LOG_STR(
"Encoder creation failed"));
123 rmt_copy_encoder_config_t encoder;
124 memset(&encoder, 0,
sizeof(encoder));
125 if (rmt_new_copy_encoder(&encoder, &this->
encoder_) != ESP_OK) {
126 this->
mark_failed(LOG_STR(
"Encoder creation failed"));
131 if (rmt_enable(this->
channel_) != ESP_OK) {
132 this->
mark_failed(LOG_STR(
"Enabling channel failed"));
166 if (rmt_tx_wait_all_done(this->
channel_, 0) != ESP_OK) {
167 ESP_LOGE(TAG,
"RMT TX still busy");
174 ESP_LOGVV(TAG,
"Writing RGB values to bus");
176#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
184 rmt_symbol_word_t *pdest = this->
rmt_buf_;
185 while (size < buffer_size) {
187 for (
int i = 0; i < 8; i++) {
196 if (this->
params_.
reset.duration0 > 0 || this->params_.reset.duration1 > 0) {
203 rmt_transmit_config_t config;
204 memset(&config, 0,
sizeof(config));
205#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
212 ESP_LOGE(TAG,
"RMT TX error");