Skip to content

Commit 000a4f5

Browse files
committed
Merge branch 'bugfix/rmt_thresh_check' into 'master'
bugfix(rmt): fix event thresh check issue See merge request !1423
2 parents 59b7d98 + ab1abff commit 000a4f5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

components/driver/rmt.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,10 @@ esp_err_t rmt_set_tx_thr_intr_en(rmt_channel_t channel, bool en, uint16_t evt_th
351351
{
352352
RMT_CHECK(channel < RMT_CHANNEL_MAX, RMT_CHANNEL_ERROR_STR, ESP_ERR_INVALID_ARG);
353353
if(en) {
354-
RMT_CHECK(evt_thresh < 256, "RMT EVT THRESH ERR", ESP_ERR_INVALID_ARG);
354+
RMT_CHECK(evt_thresh <= 256, "RMT EVT THRESH ERR", ESP_ERR_INVALID_ARG);
355+
portENTER_CRITICAL(&rmt_spinlock);
355356
RMT.tx_lim_ch[channel].limit = evt_thresh;
357+
portEXIT_CRITICAL(&rmt_spinlock);
356358
rmt_set_tx_wrap_en(channel, true);
357359
rmt_set_intr_enable_mask(BIT(channel + 24));
358360
} else {
@@ -424,8 +426,6 @@ esp_err_t rmt_config(const rmt_config_t* rmt_param)
424426
/*Set idle level */
425427
RMT.conf_ch[channel].conf1.idle_out_en = rmt_param->tx_config.idle_output_en;
426428
RMT.conf_ch[channel].conf1.idle_out_lv = idle_level;
427-
portEXIT_CRITICAL(&rmt_spinlock);
428-
429429
/*Set carrier*/
430430
RMT.conf_ch[channel].conf0.carrier_en = carrier_en;
431431
if (carrier_en) {
@@ -441,6 +441,8 @@ esp_err_t rmt_config(const rmt_config_t* rmt_param)
441441
RMT.carrier_duty_ch[channel].high = 0;
442442
RMT.carrier_duty_ch[channel].low = 0;
443443
}
444+
portEXIT_CRITICAL(&rmt_spinlock);
445+
444446
ESP_LOGD(RMT_TAG, "Rmt Tx Channel %u|Gpio %u|Sclk_Hz %u|Div %u|Carrier_Hz %u|Duty %u",
445447
channel, gpio_num, rmt_source_clk_hz, clk_div, carrier_freq_hz, carrier_duty_percent);
446448

examples/peripherals/rmt_nec_tx_rx/main/infrared_nec_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static const char* NEC_TAG = "NEC";
4040
#endif
4141

4242
#define RMT_TX_CHANNEL 1 /*!< RMT channel for transmitter */
43-
#define RMT_TX_GPIO_NUM 16 /*!< GPIO number for transmitter signal */
43+
#define RMT_TX_GPIO_NUM 18 /*!< GPIO number for transmitter signal */
4444
#define RMT_RX_CHANNEL 0 /*!< RMT channel for receiver */
4545
#define RMT_RX_GPIO_NUM 19 /*!< GPIO number for receiver */
4646
#define RMT_CLK_DIV 100 /*!< RMT counter clock divider */

0 commit comments

Comments
 (0)