@@ -351,8 +351,10 @@ esp_err_t rmt_set_tx_thr_intr_en(rmt_channel_t channel, bool en, uint16_t evt_th
351
351
{
352
352
RMT_CHECK (channel < RMT_CHANNEL_MAX , RMT_CHANNEL_ERROR_STR , ESP_ERR_INVALID_ARG );
353
353
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 );
355
356
RMT .tx_lim_ch [channel ].limit = evt_thresh ;
357
+ portEXIT_CRITICAL (& rmt_spinlock );
356
358
rmt_set_tx_wrap_en (channel , true);
357
359
rmt_set_intr_enable_mask (BIT (channel + 24 ));
358
360
} else {
@@ -424,8 +426,6 @@ esp_err_t rmt_config(const rmt_config_t* rmt_param)
424
426
/*Set idle level */
425
427
RMT .conf_ch [channel ].conf1 .idle_out_en = rmt_param -> tx_config .idle_output_en ;
426
428
RMT .conf_ch [channel ].conf1 .idle_out_lv = idle_level ;
427
- portEXIT_CRITICAL (& rmt_spinlock );
428
-
429
429
/*Set carrier*/
430
430
RMT .conf_ch [channel ].conf0 .carrier_en = carrier_en ;
431
431
if (carrier_en ) {
@@ -441,6 +441,8 @@ esp_err_t rmt_config(const rmt_config_t* rmt_param)
441
441
RMT .carrier_duty_ch [channel ].high = 0 ;
442
442
RMT .carrier_duty_ch [channel ].low = 0 ;
443
443
}
444
+ portEXIT_CRITICAL (& rmt_spinlock );
445
+
444
446
ESP_LOGD (RMT_TAG , "Rmt Tx Channel %u|Gpio %u|Sclk_Hz %u|Div %u|Carrier_Hz %u|Duty %u" ,
445
447
channel , gpio_num , rmt_source_clk_hz , clk_div , carrier_freq_hz , carrier_duty_percent );
446
448
0 commit comments