Skip to content

Commit c567f0f

Browse files
committed
Merge branch 'refactor/rmt_split_encoder_files' into 'master'
change(rmt): split rmt encoders into different files See merge request espressif/esp-idf!37955
2 parents aac2e92 + 1877605 commit c567f0f

File tree

12 files changed

+561
-573
lines changed

12 files changed

+561
-573
lines changed

components/esp_driver_rmt/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ set(public_include "include")
55
if(CONFIG_SOC_RMT_SUPPORTED)
66
list(APPEND srcs "src/rmt_common.c"
77
"src/rmt_encoder.c"
8+
"src/rmt_encoder_bytes.c"
9+
"src/rmt_encoder_copy.c"
10+
"src/rmt_encoder_simple.c"
811
"src/rmt_rx.c"
912
"src/rmt_tx.c")
1013
endif()

components/esp_driver_rmt/Kconfig

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
menu "ESP-Driver:RMT Configurations"
22
depends on SOC_RMT_SUPPORTED
3+
34
config RMT_ISR_HANDLER_IN_IRAM
45
bool "Place RMT ISR handler into IRAM"
56
select GDMA_CTRL_FUNC_IN_IRAM if SOC_RMT_SUPPORT_DMA
@@ -33,9 +34,13 @@ menu "ESP-Driver:RMT Configurations"
3334
where its cache can be disabled.
3435

3536
config RMT_ENABLE_DEBUG_LOG
36-
bool "Enable debug log"
37+
bool "Force enable debug log"
3738
default n
3839
help
39-
whether to enable the debug log message for RMT driver.
40-
Note that, this option only controls the RMT driver log, won't affect other drivers.
40+
If enabled, RMT driver component will:
41+
1. ignore the global logging settings
42+
2. compile all log messages into the binary
43+
3. set the runtime log level to VERBOSE
44+
Please enable this option by caution, as it will increase the binary size.
45+
4146
endmenu

components/esp_driver_rmt/include/driver/rmt_common.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -14,18 +14,6 @@
1414
extern "C" {
1515
#endif
1616

17-
/**
18-
* @brief RMT carrier wave configuration (for either modulation or demodulation)
19-
*/
20-
typedef struct {
21-
uint32_t frequency_hz; /*!< Carrier wave frequency, in Hz, 0 means disabling the carrier */
22-
float duty_cycle; /*!< Carrier wave duty cycle (0~100%) */
23-
struct {
24-
uint32_t polarity_active_low: 1; /*!< Specify the polarity of carrier, by default it's modulated to base signal's high level */
25-
uint32_t always_on: 1; /*!< If set, the carrier can always exist even there's not transfer undergoing */
26-
} flags; /*!< Carrier config flags */
27-
} rmt_carrier_config_t;
28-
2917
/**
3018
* @brief Delete an RMT channel
3119
*

components/esp_driver_rmt/include/driver/rmt_types.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -72,6 +72,18 @@ typedef struct {
7272
*/
7373
typedef bool (*rmt_rx_done_callback_t)(rmt_channel_handle_t rx_chan, const rmt_rx_done_event_data_t *edata, void *user_ctx);
7474

75+
/**
76+
* @brief RMT carrier wave configuration (for either modulation or demodulation)
77+
*/
78+
typedef struct {
79+
uint32_t frequency_hz; /*!< Carrier wave frequency, in Hz, 0 means disabling the carrier */
80+
float duty_cycle; /*!< Carrier wave duty cycle (0~100%) */
81+
struct {
82+
uint32_t polarity_active_low: 1; /*!< Specify the polarity of carrier, by default it's modulated to base signal's high level */
83+
uint32_t always_on: 1; /*!< If set, the carrier can always exist even there's not transfer undergoing */
84+
} flags; /*!< Carrier config flags */
85+
} rmt_carrier_config_t;
86+
7587
#ifdef __cplusplus
7688
}
7789
#endif

components/esp_driver_rmt/src/rmt_common.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,10 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#include <sys/lock.h>
8-
#include "sdkconfig.h"
9-
#if CONFIG_RMT_ENABLE_DEBUG_LOG
10-
// The local log level must be defined before including esp_log.h
11-
// Set the maximum log level for this source file
12-
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
13-
#endif
14-
#include "esp_log.h"
15-
#include "esp_check.h"
167
#include "rmt_private.h"
178
#include "clk_ctrl_os.h"
189
#include "soc/rtc.h"
19-
#include "soc/soc_caps.h"
20-
#include "soc/rmt_periph.h"
21-
#include "hal/rmt_ll.h"
2210
#include "driver/gpio.h"
23-
#include "esp_private/esp_clk_tree_common.h"
24-
#include "esp_private/periph_ctrl.h"
25-
26-
static const char *TAG = "rmt";
2711

2812
#if SOC_PERIPH_CLK_CTRL_SHARED
2913
#define RMT_CLOCK_SRC_ATOMIC() PERIPH_RCC_ATOMIC()
@@ -398,3 +382,11 @@ void rmt_create_retention_module(rmt_group_t *group)
398382
_lock_release(&s_platform.mutex);
399383
}
400384
#endif // RMT_USE_RETENTION_LINK
385+
386+
#if CONFIG_RMT_ENABLE_DEBUG_LOG
387+
__attribute__((constructor))
388+
static void rmt_override_default_log_level(void)
389+
{
390+
esp_log_level_set(TAG, ESP_LOG_VERBOSE);
391+
}
392+
#endif

0 commit comments

Comments
 (0)