From 6b0d7332297da897d00c8e7c57cc2cd05fe8d5b5 Mon Sep 17 00:00:00 2001 From: superkor Date: Thu, 15 Jan 2026 19:31:52 -0500 Subject: [PATCH] move rmt constants to constants comp --- components/constants/include/constants/rmt.h | 32 ++++++++++++++++++++ components/flatbuffers/CMakeLists.txt | 2 +- components/rmt/CMakeLists.txt | 2 +- components/rmt/include/RMTManager.h | 15 +-------- components/rmt/include/RMTSymbols.h | 6 +--- 5 files changed, 36 insertions(+), 21 deletions(-) create mode 100644 components/constants/include/constants/rmt.h diff --git a/components/constants/include/constants/rmt.h b/components/constants/include/constants/rmt.h new file mode 100644 index 0000000..048d5c0 --- /dev/null +++ b/components/constants/include/constants/rmt.h @@ -0,0 +1,32 @@ +#ifndef RMT_H +#define RMT_H + +/** + * @brief RMT Symbol Constants + */ + +#define RMT_RESOLUTION_HZ 4 * 1000 * 1000 // 4 MHz resolution +#define RMT_DURATION_SYMBOL 2 //1 us + +#define RMT_DURATION_MAX (2 * RMT_DURATION_SYMBOL) + +/** + * @brief RMT Constants + */ + +#define MAX_CHANNELS 4 +#define RMT_SYMBOL_BLOCK_SIZE 48 + +#define RECEIVE_BUFFER_SIZE 1024 //this is some value (we should probably set it to some packet size that we predetermine in some custom protocol:tm:) +#define DEBUG_TAG "RMTManager" + +#define CHANNEL_LISTENING (0x2) //channel waiting to receive +#define CHANNEL_READY_STATUS (0x1) //channel able to send and ready to start receive async job +#define CHANNEL_NOT_READY_STATUS (0x0) //channel is not ready (cannot send and/or receive) + +#define QUEUE_SIZE 10 + +#define MUTEX_MAX_WAIT_TICKS 100 + + +#endif //RMT_H \ No newline at end of file diff --git a/components/flatbuffers/CMakeLists.txt b/components/flatbuffers/CMakeLists.txt index a7b031f..85f614f 100644 --- a/components/flatbuffers/CMakeLists.txt +++ b/components/flatbuffers/CMakeLists.txt @@ -1,2 +1,2 @@ -idf_component_register(SRCS "MPIMessageBuilder.cpp" "AngleControlMessageBuilder.cpp" "TopologyMessageBuilder.cpp" "SensorMessageBuilder.cpp" +idf_component_register(SRCS "MPIMessageBuilder.cpp" "AngleControlMessageBuilder.cpp" "TopologyMessageBuilder.cpp" "SensorMessageBuilder.cpp" REQUIRES "constants" INCLUDE_DIRS "include") diff --git a/components/rmt/CMakeLists.txt b/components/rmt/CMakeLists.txt index d9d523d..9aefed6 100644 --- a/components/rmt/CMakeLists.txt +++ b/components/rmt/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register(SRCS "RMTManager.cpp" PRIV_REQUIRES driver esp_event nvs_flash esp_netif - REQUIRES esp_driver_rmt + REQUIRES esp_driver_rmt constants INCLUDE_DIRS "include") diff --git a/components/rmt/include/RMTManager.h b/components/rmt/include/RMTManager.h index f1e6109..036c591 100644 --- a/components/rmt/include/RMTManager.h +++ b/components/rmt/include/RMTManager.h @@ -8,20 +8,7 @@ #include "driver/rmt_tx.h" #include "driver/rmt_rx.h" #include "soc/gpio_num.h" - -#define MAX_CHANNELS 4 -#define RMT_SYMBOL_BLOCK_SIZE 48 - -#define RECEIVE_BUFFER_SIZE 1024 //this is some value (we should probably set it to some packet size that we predetermine in some custom protocol:tm:) -#define DEBUG_TAG "RMTManager" - -#define CHANNEL_LISTENING (0x2) //channel waiting to receive -#define CHANNEL_READY_STATUS (0x1) //channel able to send and ready to start receive async job -#define CHANNEL_NOT_READY_STATUS (0x0) //channel is not ready (cannot send and/or receive) - -#define QUEUE_SIZE 10 - -#define MUTEX_MAX_WAIT_TICKS 100 +#include "constants/rmt.h" /** * @brief This struct keeps track of the current byte and bit index of the user data being transmmitted via RMT diff --git a/components/rmt/include/RMTSymbols.h b/components/rmt/include/RMTSymbols.h index 023141d..0ab7853 100644 --- a/components/rmt/include/RMTSymbols.h +++ b/components/rmt/include/RMTSymbols.h @@ -1,11 +1,7 @@ #ifdef RMT_COMMUNICATIONS #include "driver/rmt_tx.h" - -#define RMT_RESOLUTION_HZ 4 * 1000 * 1000 // 4 MHz resolution -#define RMT_DURATION_SYMBOL 2 //1 us - -#define RMT_DURATION_MAX (2 * RMT_DURATION_SYMBOL) +#include "constants/rmt.h" //MANCHESTER ENCODING (ETHERNET STANDARD)