diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index fa01868..cf7359f 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -450,450 +450,6 @@ "RMT_CLK_SRC_DEFAULT = SOC_MOD_CLK_APB", "USBCON" ] - }, - { - "name": "Arduino", - "compilerPath": "/home/derdoktor667/.arduino15/packages/esp32/tools/esp-x32/2411/bin/xtensa-esp32-elf-g++", - "compilerArgs": [ - "-MMD", - "-w", - "-Werror=return-type", - "-iprefix" - ], - "intelliSenseMode": "gcc-x64", - "includePath": [ - "/home/derdoktor667/Github/DShotRMT/examples/dshot300", - "/home/derdoktor667/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.5-b66b5448-v1/esp32/qio_qspi/include", - "/home/derdoktor667/.arduino15/packages/esp32/hardware/esp32/3.3.0/cores/esp32", - "/home/derdoktor667/.arduino15/packages/esp32/hardware/esp32/3.3.0/variants/esp32", - "/home/derdoktor667/Arduino/libraries/DShotRMT/src", - "/home/derdoktor667/.arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0", - "/home/derdoktor667/.arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/xtensa-esp-elf/esp32", - "/home/derdoktor667/.arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/backward", - "/home/derdoktor667/.arduino15/packages/esp32/tools/esp-x32/2411/lib/gcc/xtensa-esp-elf/14.2.0/include", - "/home/derdoktor667/.arduino15/packages/esp32/tools/esp-x32/2411/lib/gcc/xtensa-esp-elf/14.2.0/include-fixed", - "/home/derdoktor667/.arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include" - ], - "forcedInclude": [ - "/home/derdoktor667/.arduino15/packages/esp32/hardware/esp32/3.3.0/cores/esp32/Arduino.h" - ], - "cStandard": "c11", - "cppStandard": "c++11", - "defines": [ - "F_CPU=240000000L", - "ARDUINO=10607", - "ARDUINO_ESP32_DEV", - "ARDUINO_ARCH_ESP32", - "ARDUINO_BOARD=\"ESP32_DEV\"", - "ARDUINO_VARIANT=\"esp32\"", - "ARDUINO_PARTITION_default", - "ARDUINO_HOST_OS=\"linux\"", - "ARDUINO_FQBN=\"esp32:esp32:esp32:JTAGAdapter=default,PSRAM=disabled,PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,LoopCore=1,EventsCore=1,DebugLevel=none,EraseFlash=all,ZigbeeMode=default\"", - "ESP32=ESP32", - "CORE_DEBUG_LEVEL=0", - "ARDUINO_RUNNING_CORE=1", - "ARDUINO_EVENT_RUNNING_CORE=1", - "ARDUINO_USB_CDC_ON_BOOT=0", - "__DBL_MIN_EXP__=(-1021)", - "__XCHAL_HAVE_FP=1", - "__cpp_nontype_template_parameter_auto=201606L", - "__UINT_LEAST16_MAX__=0xffff", - "__ATOMIC_ACQUIRE=2", - "__FLT_MIN__=1.1754943508222875e-38F", - "__GCC_IEC_559_COMPLEX=0", - "__XCHAL_HAVE_PREDICTED_BRANCHES=0", - "__cpp_aggregate_nsdmi=201304L", - "__UINT_LEAST8_TYPE__=unsigned char", - "__INTMAX_C(c)=c ## LL", - "__XCHAL_HAVE_ADDX=1", - "__CHAR_BIT__=8", - "__XCHAL_DCACHE_LINESIZE=16", - "__XTENSA_MARCH_EARLIEST=260003", - "__XCHAL_DCACHE_LINEWIDTH=4", - "__UINT8_MAX__=0xff", - "__WINT_MAX__=0xffffffffU", - "__FLT32_MIN_EXP__=(-125)", - "__cpp_static_assert=201411L", - "__ORDER_LITTLE_ENDIAN__=1234", - "__SIZE_MAX__=0xffffffffU", - "__WCHAR_MAX__=0xffff", - "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1=1", - "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2=1", - "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4=1", - "__DBL_DENORM_MIN__=double(4.9406564584124654e-324L)", - "__GCC_ATOMIC_CHAR_LOCK_FREE=2", - "__GCC_IEC_559=0", - "__FLT32X_DECIMAL_DIG__=17", - "__FLT_EVAL_METHOD__=0", - "__cpp_binary_literals=201304L", - "__FLT64_DECIMAL_DIG__=17", - "__cpp_noexcept_function_type=201510L", - "__GCC_ATOMIC_CHAR32_T_LOCK_FREE=2", - "__cpp_variadic_templates=200704L", - "__UINT_FAST64_MAX__=0xffffffffffffffffULL", - "__SIG_ATOMIC_TYPE__=int", - "__DBL_MIN_10_EXP__=(-307)", - "__FINITE_MATH_ONLY__=0", - "__cpp_variable_templates=201304L", - "__XCHAL_HAVE_L32R=1", - "__FLT32X_MAX_EXP__=1024", - "__GNUC_PATCHLEVEL__=0", - "__FLT32_HAS_DENORM__=1", - "__UINT_FAST8_MAX__=0xffffffffU", - "__cpp_rvalue_reference=200610L", - "__XCHAL_HAVE_LOOPS=1", - "__cpp_nested_namespace_definitions=201411L", - "__XCHAL_DEBUGLEVEL=6", - "__INT8_C(c)=c", - "__XCHAL_HAVE_DFP_RECIP=0", - "__INT_LEAST8_WIDTH__=8", - "__cpp_variadic_using=201611L", - "__UINT_LEAST64_MAX__=0xffffffffffffffffULL", - "__INT_LEAST8_MAX__=0x7f", - "__cpp_attributes=200809L", - "__cpp_capture_star_this=201603L", - "__SHRT_MAX__=0x7fff", - "__LDBL_MAX__=1.7976931348623157e+308L", - "__cpp_if_constexpr=201606L", - "__XCHAL_ICACHE_LINESIZE=16", - "__LDBL_IS_IEC_60559__=1", - "__UINT_LEAST8_MAX__=0xff", - "__GCC_ATOMIC_BOOL_LOCK_FREE=2", - "__UINTMAX_TYPE__=long long unsigned int", - "__cpp_nsdmi=200809L", - "__FLT_EVAL_METHOD_TS_18661_3__=0", - "__UINT32_MAX__=0xffffffffUL", - "__GXX_EXPERIMENTAL_CXX0X__=1", - "__LDBL_MAX_EXP__=1024", - "__WINT_MIN__=0U", - "__FLT32X_IS_IEC_60559__=1", - "__XCHAL_HAVE_THREADPTR=1", - "__INT_LEAST16_WIDTH__=16", - "__SCHAR_MAX__=0x7f", - "__WCHAR_MIN__=0", - "__XCHAL_ICACHE_LINEWIDTH=4", - "__INT64_C(c)=c ## LL", - "__GCC_ATOMIC_POINTER_LOCK_FREE=2", - "__ATOMIC_SEQ_CST=5", - "__SIZEOF_INT__=4", - "__FLT32X_MANT_DIG__=53", - "__GCC_ATOMIC_CHAR16_T_LOCK_FREE=2", - "__cpp_aligned_new=201606L", - "__XCHAL_HAVE_FP_RECIP=1", - "__FLT32_MAX_10_EXP__=38", - "__STDC_HOSTED__=1", - "__XCHAL_HAVE_MUL32=1", - "__XTENSA_EL__=1", - "__cpp_decltype_auto=201304L", - "__DBL_DIG__=15", - "__XCHAL_HAVE_MUL16=1", - "__FLT_EPSILON__=1.1920928955078125e-7F", - "__GXX_WEAK__=1", - "__SHRT_WIDTH__=16", - "__FLT32_IS_IEC_60559__=1", - "__LDBL_MIN__=2.2250738585072014e-308L", - "__DBL_IS_IEC_60559__=1", - "__cpp_threadsafe_static_init=200806L", - "__cpp_enumerator_attributes=201411L", - "__XCHAL_HAVE_MMU=0", - "__FLT32X_HAS_INFINITY__=1", - "__INT32_MAX__=0x7fffffffL", - "__XCHAL_HAVE_DIV32=1", - "__INT_WIDTH__=32", - "__XTENSA_MARCH_LATEST=260003", - "__DECIMAL_DIG__=17", - "__FLT64_EPSILON__=2.2204460492503131e-16F64", - "__INT16_MAX__=0x7fff", - "__FLT64_MIN_EXP__=(-1021)", - "__XCHAL_DCACHE_SIZE=0", - "__LDBL_HAS_QUIET_NAN__=1", - "__cpp_return_type_deduction=201304L", - "__XCHAL_HAVE_BOOLEANS=1", - "__FLT64_MANT_DIG__=53", - "__XTHAL_ABI_WINDOWED=0", - "__GNUC__=14", - "__GXX_RTTI=1", - "__FLT_HAS_DENORM__=1", - "__SIZEOF_LONG_DOUBLE__=8", - "__XCHAL_HAVE_CONST16=0", - "__BIGGEST_ALIGNMENT__=16", - "__STDC_UTF_16__=1", - "__FLT64_MAX_10_EXP__=308", - "__cpp_delegating_constructors=200604L", - "__DBL_MAX__=double(1.7976931348623157e+308L)", - "__cpp_raw_strings=200710L", - "__INT_FAST32_MAX__=0x7fffffff", - "__DBL_HAS_INFINITY__=1", - "__cpp_deduction_guides=201703L", - "__HAVE_SPECULATION_SAFE_VALUE=1", - "__cpp_fold_expressions=201603L", - "__INTPTR_WIDTH__=32", - "__UINT_LEAST32_MAX__=0xffffffffUL", - "__FLT32X_HAS_DENORM__=1", - "__INT_FAST16_TYPE__=int", - "__XCHAL_HAVE_RELEASE_SYNC=1", - "__LDBL_HAS_DENORM__=1", - "__cplusplus=201703L", - "__cpp_ref_qualifiers=200710L", - "__INT_LEAST32_MAX__=0x7fffffffL", - "__DEPRECATED=1", - "__cpp_rvalue_references=200610L", - "__DBL_MAX_EXP__=1024", - "__WCHAR_WIDTH__=16", - "__FLT32_MAX__=3.4028234663852886e+38F32", - "__GCC_ATOMIC_LONG_LOCK_FREE=2", - "__PTRDIFF_MAX__=0x7fffffff", - "__FLT32_HAS_QUIET_NAN__=1", - "__GNUG__=14", - "__LONG_LONG_MAX__=0x7fffffffffffffffLL", - "__SIZEOF_SIZE_T__=4", - "__SIZEOF_WINT_T__=4", - "__FLT32X_DIG__=15", - "__LONG_LONG_WIDTH__=64", - "__cpp_initializer_lists=200806L", - "__FLT32_MAX_EXP__=128", - "__XCHAL_HAVE_MINMAX=1", - "__cpp_hex_float=201603L", - "__XCHAL_NUM_IBREAK=2", - "__GXX_ABI_VERSION=1019", - "__FLT_MIN_EXP__=(-125)", - "__cpp_lambdas=200907L", - "__INT_FAST64_TYPE__=long long int", - "__FP_FAST_FMAF=1", - "__FLT64_DENORM_MIN__=4.9406564584124654e-324F64", - "__DBL_MIN__=double(2.2250738585072014e-308L)", - "__SIZEOF_POINTER__=4", - "__DBL_HAS_QUIET_NAN__=1", - "__FLT32X_EPSILON__=2.2204460492503131e-16F32x", - "__XSHAL_HAVE_TEXT_SECTION_LITERALS=1", - "__FLT64_MIN_10_EXP__=(-307)", - "__REGISTER_PREFIX__", - "__UINT16_MAX__=0xffff", - "__XSHAL_USE_ABSOLUTE_LITERALS=0", - "__LDBL_HAS_INFINITY__=1", - "__FLT32_MIN__=1.1754943508222875e-38F32", - "__UINT8_TYPE__=unsigned char", - "__FLT_DIG__=6", - "__NO_INLINE__=1", - "__DEC_EVAL_METHOD__=2", - "__FLT_MANT_DIG__=24", - "__LDBL_DECIMAL_DIG__=17", - "__VERSION__=\"14.2.0\"", - "__UINT64_C(c)=c ## ULL", - "__XCHAL_NUM_AREGS=64", - "__cpp_unicode_characters=201411L", - "__XCHAL_HAVE_XEA3=0", - "__GCC_ATOMIC_INT_LOCK_FREE=2", - "__XCHAL_HAVE_DENSITY=1", - "__FLT32_MANT_DIG__=24", - "__FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__", - "__XCHAL_HAVE_CLAMPS=0", - "__XCHAL_HAVE_DFP_RSQRT=0", - "__cpp_aggregate_bases=201603L", - "__XCHAL_HAVE_NSA=1", - "__XCHAL_HAVE_WINDOWED=1", - "__SCHAR_WIDTH__=8", - "__INT32_C(c)=c ## L", - "__ORDER_PDP_ENDIAN__=3412", - "__INT_FAST32_TYPE__=int", - "__UINT_LEAST16_TYPE__=short unsigned int", - "__DBL_HAS_DENORM__=1", - "__XCHAL_HAVE_DEBUG=1", - "__cpp_rtti=199711L", - "__SIZE_TYPE__=unsigned int", - "__UINT64_MAX__=0xffffffffffffffffULL", - "__FLT_IS_IEC_60559__=1", - "__GNUC_WIDE_EXECUTION_CHARSET_NAME=\"UTF-16LE\"", - "__INT8_TYPE__=signed char", - "__cpp_digit_separators=201309L", - "__ELF__=1", - "__XSHAL_ABI=0", - "__xtensa__=1", - "__FLT_RADIX__=2", - "__INT_LEAST16_TYPE__=short int", - "__LDBL_EPSILON__=2.2204460492503131e-16L", - "__UINTMAX_C(c)=c ## ULL", - "__FLT32X_MIN__=2.2250738585072014e-308F32x", - "__XCHAL_HAVE_DFP_SQRT=0", - "__SIG_ATOMIC_MAX__=0x7fffffff", - "__XCHAL_HAVE_MAC16=1", - "__GCC_ATOMIC_WCHAR_T_LOCK_FREE=2", - "__USER_LABEL_PREFIX__", - "__SIZEOF_PTRDIFF_T__=4", - "__XCHAL_MMU_MIN_PTE_PAGE_SIZE=1", - "__XCHAL_DCACHE_IS_WRITEBACK=0", - "__SIZEOF_LONG__=4", - "__LDBL_DIG__=15", - "__FLT64_IS_IEC_60559__=1", - "__XCHAL_MAX_INSTRUCTION_SIZE=3", - "__FLT32X_MIN_EXP__=(-1021)", - "__INT_FAST16_MAX__=0x7fffffff", - "__GCC_CONSTRUCTIVE_SIZE=32", - "__FLT64_DIG__=15", - "__UINT_FAST32_MAX__=0xffffffffU", - "__UINT_LEAST64_TYPE__=long long unsigned int", - "__FLT_HAS_QUIET_NAN__=1", - "__FLT_MAX_10_EXP__=38", - "__FLT_HAS_INFINITY__=1", - "__GNUC_EXECUTION_CHARSET_NAME=\"UTF-8\"", - "__CHAR_UNSIGNED__=1", - "__cpp_unicode_literals=200710L", - "__UINT_FAST16_TYPE__=unsigned int", - "__INT_FAST32_WIDTH__=32", - "__CHAR16_TYPE__=short unsigned int", - "__PRAGMA_REDEFINE_EXTNAME=1", - "__SIZE_WIDTH__=32", - "__INT_LEAST16_MAX__=0x7fff", - "__INT64_MAX__=0x7fffffffffffffffLL", - "__FLT32_DENORM_MIN__=1.4012984643248171e-45F32", - "__SIG_ATOMIC_WIDTH__=32", - "__INT_LEAST64_TYPE__=long long int", - "__INT16_TYPE__=short int", - "__INT_LEAST8_TYPE__=signed char", - "__cpp_structured_bindings=201606L", - "__INT_FAST8_MAX__=0x7fffffff", - "__INTPTR_MAX__=0x7fffffff", - "__cpp_sized_deallocation=201309L", - "__cpp_guaranteed_copy_elision=201606L", - "__FLT64_HAS_QUIET_NAN__=1", - "__FLT32_MIN_10_EXP__=(-37)", - "__EXCEPTIONS=1", - "__UINT16_C(c)=c", - "__XCHAL_M_STAGE=3", - "__PTRDIFF_WIDTH__=32", - "__LDBL_MANT_DIG__=53", - "__cpp_range_based_for=201603L", - "__FLT64_HAS_INFINITY__=1", - "__STDCPP_DEFAULT_NEW_ALIGNMENT__=8", - "__SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1)", - "__XCHAL_ICACHE_SIZE=0", - "__cpp_nontype_template_args=201411L", - "__INTPTR_TYPE__=int", - "__UINT16_TYPE__=short unsigned int", - "__WCHAR_TYPE__=short unsigned int", - "__XCHAL_HAVE_DEPBITS=0", - "__SIZEOF_FLOAT__=4", - "__UINTPTR_MAX__=0xffffffffU", - "__INT_FAST64_WIDTH__=64", - "__cpp_decltype=200707L", - "__FLT32_DECIMAL_DIG__=9", - "__INT_FAST64_MAX__=0x7fffffffffffffffLL", - "__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1", - "__FLT_NORM_MAX__=3.4028234663852886e+38F", - "__XCHAL_HAVE_DFP=0", - "__FLT32_HAS_INFINITY__=1", - "__UINT_FAST64_TYPE__=long long unsigned int", - "__cpp_inline_variables=201606L", - "__INT_MAX__=0x7fffffff", - "__XCHAL_HAVE_EXCLUSIVE=0", - "__STDCPP_THREADS__=1", - "__INT64_TYPE__=long long int", - "__XCHAL_HAVE_DFP_DIV=0", - "__FLT_MAX_EXP__=128", - "__XCHAL_INST_FETCH_WIDTH=4", - "__DBL_MANT_DIG__=53", - "__cpp_inheriting_constructors=201511L", - "__INT_LEAST64_MAX__=0x7fffffffffffffffLL", - "__FP_FAST_FMAF32=1", - "__WINT_TYPE__=unsigned int", - "__UINT_LEAST32_TYPE__=long unsigned int", - "__SIZEOF_SHORT__=2", - "__FLT32_NORM_MAX__=3.4028234663852886e+38F32", - "__LDBL_MIN_EXP__=(-1021)", - "__XCHAL_HAVE_S32C1I=1", - "__FLT64_MAX__=1.7976931348623157e+308F64", - "__WINT_WIDTH__=32", - "__cpp_template_auto=201606L", - "__INT_LEAST64_WIDTH__=64", - "__FLT32X_MAX_10_EXP__=308", - "__cpp_namespace_attributes=201411L", - "__WCHAR_UNSIGNED__=1", - "__LDBL_MAX_10_EXP__=308", - "__ATOMIC_RELAXED=0", - "__DBL_EPSILON__=double(2.2204460492503131e-16L)", - "__XCHAL_HAVE_SEXT=1", - "__INT_LEAST32_TYPE__=long int", - "__XTENSA_WINDOWED_ABI__=1", - "__UINT8_C(c)=c", - "__FLT64_MAX_EXP__=1024", - "__SIZEOF_WCHAR_T__=2", - "__XCHAL_HAVE_FP_POSTINC=1", - "__FLT64_NORM_MAX__=1.7976931348623157e+308F64", - "__INTMAX_MAX__=0x7fffffffffffffffLL", - "__INT_FAST8_TYPE__=int", - "__XCHAL_HAVE_MUL32_HIGH=1", - "__GNUC_STDC_INLINE__=1", - "__FLT64_HAS_DENORM__=1", - "__FLT32_EPSILON__=1.1920928955078125e-7F32", - "__DBL_DECIMAL_DIG__=17", - "__STDC_UTF_32__=1", - "__XCHAL_HAVE_FP_DIV=1", - "__INT_FAST8_WIDTH__=32", - "__FLT32X_MAX__=1.7976931348623157e+308F32x", - "__DBL_NORM_MAX__=double(1.7976931348623157e+308L)", - "__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__", - "__GCC_DESTRUCTIVE_SIZE=32", - "__XTENSA__=1", - "__INTMAX_WIDTH__=64", - "__ORDER_BIG_ENDIAN__=4321", - "__XTHAL_ABI_CALL0=1", - "__cpp_runtime_arrays=198712L", - "__FLT32_DIG__=6", - "__UINT64_TYPE__=long long unsigned int", - "__UINT32_C(c)=c ## UL", - "__cpp_alias_templates=200704L", - "__FLT_DENORM_MIN__=1.4012984643248171e-45F", - "__INT8_MAX__=0x7f", - "__LONG_WIDTH__=32", - "__UINT_FAST32_TYPE__=unsigned int", - "__FLT32X_NORM_MAX__=1.7976931348623157e+308F32x", - "__CHAR32_TYPE__=long unsigned int", - "__FLT_MAX__=3.4028234663852886e+38F", - "__cpp_constexpr=201603L", - "__XCHAL_HAVE_FP_RSQRT=1", - "__INT32_TYPE__=long int", - "__SIZEOF_DOUBLE__=8", - "__cpp_exceptions=199711L", - "__FLT_MIN_10_EXP__=(-37)", - "__FLT64_MIN__=2.2250738585072014e-308F64", - "__INT_LEAST32_WIDTH__=32", - "__INTMAX_TYPE__=long long int", - "__XCHAL_HAVE_ABS=1", - "__FLT32X_HAS_QUIET_NAN__=1", - "__ATOMIC_CONSUME=1", - "__XCHAL_NUM_DBREAK=2", - "__XCHAL_HAVE_WIDE_BRANCHES=0", - "__GNUC_MINOR__=2", - "__INT_FAST16_WIDTH__=32", - "__UINTMAX_MAX__=0xffffffffffffffffULL", - "__FLT32X_DENORM_MIN__=4.9406564584124654e-324F32x", - "__cpp_template_template_args=201611L", - "__DBL_MAX_10_EXP__=308", - "__LDBL_DENORM_MIN__=4.9406564584124654e-324L", - "__INT16_C(c)=c", - "__STDC__=1", - "__PTRDIFF_TYPE__=int", - "__LONG_MAX__=0x7fffffffL", - "__XCHAL_HAVE_FP_SQRT=1", - "__UINT32_TYPE__=long unsigned int", - "__FLT32X_MIN_10_EXP__=(-307)", - "__UINTPTR_TYPE__=unsigned int", - "__LDBL_MIN_10_EXP__=(-307)", - "__cpp_generic_lambdas=201304L", - "__SIZEOF_LONG_LONG__=8", - "__cpp_user_defined_literals=200809L", - "__GCC_ATOMIC_LLONG_LOCK_FREE=1", - "__FLT_DECIMAL_DIG__=9", - "__UINT_FAST16_MAX__=0xffffffffU", - "__LDBL_NORM_MAX__=1.7976931348623157e+308L", - "__GCC_ATOMIC_SHORT_LOCK_FREE=2", - "__XCHAL_HAVE_BE=0", - "__UINT_FAST8_TYPE__=unsigned int", - "__cpp_init_captures=201304L", - "__ATOMIC_ACQ_REL=4", - "__ATOMIC_RELEASE=3", - "USBCON" - ] } ] -} \ No newline at end of file +} diff --git a/README.md b/README.md index f1cc72b..7e96ee0 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,92 @@ +# DShotRMT - ESP32 RMT DShot Driver + [![Arduino CI](https://github.com/derdoktor667/DShotRMT/actions/workflows/ci.yml/badge.svg)](https://github.com/derdoktor667/DShotRMT/actions/workflows/ci.yml) -# DShotRMT - ESP32 Library (Rewrite for ESP-IDF 5) +A C++ library for generating DShot signals on ESP32 microcontrollers using the RMT (Remote Control) peripheral. It's designed for both Arduino and ESP-IDF projects, providing a simple and efficient way to control brushless motors. -A simple Arduino IDE / C++ library for generating DShot signals on the ESP32 (`fqbn: esp32:esp32:esp32`) using the ESP-IDF 5 RMT encoder API (`rmt_tx.h` / `rmt_rx.h`). -Supports all standard DShot modes (150, 300, 600, 1200) and features signal generation and frame transmission with configurable timing. +This library is a rewrite using the modern ESP-IDF 5 RMT encoder API (`rmt_tx.h` / `rmt_rx.h`) for improved performance and flexibility. The legacy version using the old `rmt.h` API is available in the `oldAPI` branch. -**Now with BiDirectional DShot support, advanced command management, and modern web control interface!** +## ๐Ÿš€ Core Features -> The legacy version (using the old `rmt.h` API) is still available in the `oldAPI` branch. - ---- - -## ๐Ÿš€ Features - -- **All DShot Modes:** DSHOT150, DSHOT300 (default), DSHOT600, DSHOT1200 -- **BiDirectional DShot:** Full support for RPM telemetry feedback -- **Web Control Interface:** Modern responsive web UI with WiFi access point -- **Safety Features:** Arming/disarming system with motor lockout protection -- **Dual Control Options:** Web interface and serial console control -- **Real-time Telemetry:** Live RPM monitoring and data display -- **Hardware-Timed Signals:** Independent, precise signal generation using ESP32 RMT peripheral -- **Configurable Timing:** Ensures ESCs can reliably detect frame boundaries -- **Error Handling:** Comprehensive result reporting with success/failure status -- **Simple API:** Easy integration into your Arduino or ESP-IDF project - ---- +- **Multiple DShot Modes:** Supports DSHOT150, DSHOT300, DSHOT600, and DSHOT1200. +- **Bidirectional DShot:** Full support for RPM telemetry feedback. +- **Hardware-Timed Signals:** Precise signal generation using the ESP32 RMT peripheral, ensuring stable and reliable motor control. +- **Simple API:** Easy-to-use C++ class for sending throttle commands and receiving telemetry data. +- **Efficient and Lightweight:** The core library has no external dependencies. +- **Arduino and ESP-IDF Compatible:** Can be used in both Arduino and ESP-IDF projects. ## ๐Ÿ“ฆ Installation ### Arduino IDE -1. Search "Arduino Library Manager" for "DShotRMT" -or - -1. Clone this repository or download as ZIP -2. Place in your Arduino libraries folder (`~/Arduino/libraries/DShotRMT/`) -3. Restart Arduino IDE +1. Open the Arduino Library Manager (`Sketch` > `Include Library` > `Manage Libraries...`). +2. Search for "DShotRMT" and click "Install". +3. Alternatively, you can clone this repository or download it as a ZIP file and place it in your Arduino libraries folder (`~/Arduino/libraries/DShotRMT/`). ### PlatformIO -Add to your `platformio.ini`: + +Add the following to your `platformio.ini` file: + +```ini +lib_deps = + https://github.com/derdoktor667/DShotRMT.git +``` + +## โšก Quick Start + +Here's a basic example of how to use the `DShotRMT` library to control a motor: + +```cpp +#include +#include + +// Define the GPIO pin connected to the motor ESC +const gpio_num_t MOTOR_PIN = GPIO_NUM_27; + +// Create a DShotRMT instance for DSHOT300 +DShotRMT motor(MOTOR_PIN, DSHOT300); + +void setup() { + Serial.begin(115200); + + // Initialize the DShot motor + motor.begin(); + + Serial.println("Motor initialized. Sending low throttle for 5 seconds..."); + + // Send a low throttle command for 5 seconds + for (int i = 0; i < 500; i++) { + motor.sendThrottle(100); + delay(10); + } + + Serial.println("Stopping motor."); + motor.sendThrottle(0); +} + +void loop() { + // Your main code here +} +``` + +## ๐ŸŽฎ Examples + +The `examples` folder contains more advanced examples: + +- **`dshot300`:** A simple example demonstrating how to send DShot commands and receive telemetry via the serial monitor. +- **`web_control`:** A full-featured web application for controlling a motor from a web browser. It creates a WiFi access point and serves a web page with a throttle slider and arming switch. +- **`web_client`:** A variation of the `web_control` example that connects to an existing WiFi network instead of creating its own access point. + +### Dependencies for Web Examples + +The `web_control` and `web_client` examples require the following additional libraries: + +- [ArduinoJson](https://github.com/bblanchon/ArduinoJson) +- [ESPAsyncWebServer](https://github.com/ESP32Async/ESPAsyncWebServer) +- [AsyncTCP](https://github.com/ESP32Async/AsyncTCP) + +You can install these libraries using the Arduino Library Manager or by adding them to your `platformio.ini` file: + ```ini lib_deps = https://github.com/derdoktor667/DShotRMT.git @@ -47,228 +95,22 @@ lib_deps = https://github.com/ESP32Async/AsyncTCP ``` -### Manual Installation -```sh -git clone https://github.com/derdoktor667/DShotRMT.git -``` +## ๐Ÿ“š API Reference -### Dependencies +The main class is `DShotRMT`. Here are the most important methods: -There are no dependencies for the main library. The extended -example sketches are using these libraries: +- `DShotRMT(gpio_num_t gpio, dshot_mode_t mode, bool is_bidirectional = false)`: Constructor to create a new DShotRMT instance. +- `begin()`: Initializes the RMT peripheral and the DShot encoder. +- `sendThrottle(uint16_t throttle)`: Sends a throttle value (48-2047) to the motor. +- `sendCommand(uint16_t command)`: Sends a DShot command (0-47) to the motor. +- `getTelemetry(uint16_t magnet_count)`: Receives and parses telemetry data from the motor (for bidirectional DShot). -**Web Interface Examples (web_control.ino / web_client.ino):** -```ini -lib_deps = - https://github.com/derdoktor667/DShotRMT - https://github.com/bblanchon/ArduinoJson - https://github.com/ESP32Async/ESPAsyncWebServer - https://github.com/ESP32Async/AsyncTCP -``` - ---- - -## โšก Quick Start - -### Basic Usage (DShotRMT) - -```cpp -// Generate "dshot300" example sketch with Arduino IDE / CLI. -``` ---- - -## ๐ŸŒ Web Control Interface - -The DShotRMT library now includes a modern web interface for wireless motor control: - -### Features -- **Responsive Design:** Works on mobile phones, tablets, and desktop computers -- **WiFi Access Point:** Creates hotspot "DShotRMT Control" (Password: 12345678) -- **Safety System:** Arming/disarming switch prevents accidental motor activation -- **Real-time Control:** Instant throttle response via WebSocket communication -- **Live Telemetry:** Real-time RPM display (bidirectional mode only) -- **Auto-reconnect:** Automatically reconnects on connection loss - -### Web Interface Access -1. Connect to WiFi network: **"DShotRMT Control"** -2. Password: **12345678** -3. Open browser and navigate to: **http://10.10.10.1** - -### Web Client Mode -1. Setup SSID and Password in web_client.ino -2. Open serial for IP -3. Open browser, http://IP - -### Safety Features -- Motor control is **disabled by default** (disarmed state) -- Toggle the **ARMING SWITCH** to enable motor control -- Throttle slider is **locked** when disarmed -- **Emergency stop** resets all values to safe state - -### Technical Implementation -- **AsyncWebServer** for HTTP requests -- **WebSocket** communication for real-time data -- **JSON** message format for data exchange -- **WiFi SoftAP** mode for standalone operation -- **Automatic client cleanup** prevents memory leaks - -### โš ๏ธ Known Issus -Make sure you are using these libraries for [ESPAsyncWebServer](https://github.com/ESP32Async/ESPAsyncWebServer) and [AsyncTCP](https://github.com/ESP32Async/AsyncTCP) to use "web_control.ino" example sketch. - ---- - -## ๐Ÿ“š Extras - -### Basic DShot Control with Web Interface (`web_control.ino`) -- **Web Control Interface:** Modern responsive web UI accessible at `http://10.10.10.1` -- **WiFi Access Point:** Creates hotspot "DShotRMT Control" for wireless control -- **Safety Features:** Arming/disarming system with motor safety lockout -- **Real-time Data:** Live RPM telemetry display (bidirectional mode) -- **Dual Control:** Both web interface and serial console control -- **WebSocket Communication:** Real-time bidirectional data exchange - -**Web Interface Features:** -- Responsive design optimized for mobile and desktop -- Visual arming switch with safety lockout -- Smooth throttle slider with real-time feedback -- Live RPM monitoring display -- Automatic reconnection on connection loss - ---- - -## ๐Ÿ”ง Hardware Configuration - -### Supported DShot Modes - -| DSHOT | Bitrate | TH1 | TH0 | Bit Time (ยตs) | Frame Time (ยตs) | -|-------|-------------|-------|--------|---------------|-----------------| -| 150 | 150 kbit/s | 5.00 | 2.50 | 6.67 | ~106.72 | -| **300** | **300 kbit/s** | **2.50** | **1.25** | **3.33** | **~53.28** | -| 600 | 600 kbit/s | 1.25 | 0.625 | 1.67 | ~26.72 | - -For DShot, T1H length is always double T0H length. - -### GPIO Configuration -```cpp -// Using GPIO number -DShotRMT motor(17, DSHOT300); - -// Using GPIO enum -DShotRMT motor(GPIO_NUM_17, DSHOT300); - -// With bidirectional support -DShotRMT motor(17, DSHOT300, true); - -// Also possible, defaults (17, DSHOT300, false) -DShotRMT motor(); -``` - - ---- - -## ๐ŸŽฏ DShot Commands (experimental) - -| Command | Value | Description | Usage | -|---------|-------|-------------|-------| -| MOTOR_STOP | 0 | Stop motor | Always available | -| BEACON 1 - 5 | 1 - 5 | Motor beeping | Motor identification | -| ESC_INFO | 6 | Request ESC info | Get ESC version/settings | -| SPIN_DIRECTION_1/2 | 7 - 8 | Set spin direction | Motor configuration | -| 3D_MODE_OFF/ON | 9 - 10 | 3D mode control | Bidirectional flight | -| SAVE_SETTINGS | 12 | Save to EEPROM | Permanent configuration | -| EXTENDED_TELEMETRY_ENABLE/DISABLE | 13 - 14 | Telemetry control | Data transmission | -| SPIN_DIRECTION_NORMAL/REVERSED | 20 - 21 | Spin direction | Alias commands | -| LED 0-3_ON/OFF | 22 - 29 | LED control | BLHeli32 only | -| AUDIO_STREAM_MODE | 30 | Audio mode toggle | KISS ESCs | -| SILENT_MODE | 31 | Silent mode toggle | KISS ESCs | - ---- - -## ๐Ÿ“š DShot Protocol Details - -![DShotRMT](https://raw.githubusercontent.com/derdoktor667/DShotRMT/refs/heads/main/img/dshot300.png) - -### Packet Structure -Each DShot frame consists of 16 bits: -- **11 bits:** Throttle/command value (0-2047) -- **1 bit:** Telemetry request flag -- **4 bits:** CRC checksum - -### Checksum Calculation -```cpp -// Standard DShot CRC -uint16_t crc = (data ^ (data >> 4) ^ (data >> 8)) & 0x0F; - -// Bidirectional DShot (inverted CRC) -uint16_t crc = (~(data ^ (data >> 4) ^ (data >> 8))) & 0x0F; -``` - -### Bidirectional DShot -- **Inverted Logic:** High/low levels are inverted -- **GCR Encoding:** Telemetry uses Group Code Recording -- **21-bit Response:** 1 start + 16 data + 4 CRC bits -- **eRPM Data:** Electrical RPM transmitted back to controller - ---- - -## ๐Ÿ› ๏ธ ESP32 RMT Peripheral - -The library utilizes the ESP32's RMT (Remote Control) peripheral for precise signal generation: - -### Advantages -- **Hardware Timing:** No CPU intervention during transmission -- **Concurrent Operation:** Multiple channels can run simultaneously -- **DMA Support:** Efficient, automatic memory-to-peripheral transfers - ---- - -## ๐Ÿ“– References & Documentation - -### DShot Protocol -- [DSHOT โ€“ the missing Handbook](https://brushlesswhoop.com/dshot-and-bidirectional-dshot/) -- [DSHOT in the Dark](https://dmrlawson.co.uk/index.php/2017/12/04/dshot-in-the-dark/) -- [Betaflight DShot Implementation](https://github.com/betaflight/betaflight) - -### ESP32 Documentation -- [ESP32 Technical Reference Manual](https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf) -- [ESP-IDF RMT Driver](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/rmt.html) -- [Arduino ESP32 Core](https://github.com/espressif/arduino-esp32) - ---- +For more details, please refer to the `DShotRMT.h` header file. ## ๐Ÿค Contributing -We welcome contributions! Please: - -1. Fork the repository -2. Create a feature branch -3. Make your changes with tests -4. Submit a pull request - -### Development Guidelines -- Follow existing code style -- Add documentation for new features -- Include examples where appropriate -- Test with real hardware when possible - -### Reporting Issues -When reporting issues, please include: -- ESP32 board type and version -- Arduino/ESP-IDF version -- ESC type and firmware -- Complete error messages -- Minimal reproduction code - ---- +Contributions are welcome! Please fork the repository, create a feature branch, and submit a pull request. ## ๐Ÿ“„ License -MIT License โ€“ see [LICENSE](LICENSE) - ---- - -## ๐Ÿ‘ค Author - -**Wastl Kraus** -- GitHub: [@derdoktor667](https://github.com/derdoktor667) -- Website: [wir-sind-die-matrix.de](https://wir-sind-die-matrix.de) +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. \ No newline at end of file diff --git a/examples/dshot300/dshot300.ino b/examples/dshot300/dshot300.ino index 42bf4d7..3a804d3 100644 --- a/examples/dshot300/dshot300.ino +++ b/examples/dshot300/dshot300.ino @@ -14,14 +14,14 @@ static constexpr auto &USB_SERIAL = Serial0; static constexpr auto USB_SERIAL_BAUD = 115200; // Motor configuration - Pin number or GPIO_PIN -static constexpr gpio_num_t MOTOR01_PIN = GPIO_NUM_17; +static constexpr gpio_num_t MOTOR01_PIN = GPIO_NUM_27; // static constexpr auto MOTOR01_PIN = 17; // Supported: DSHOT150, DSHOT300, DSHOT600, (DSHOT1200) static constexpr dshot_mode_t DSHOT_MODE = DSHOT300; // BiDirectional DShot Support (default: false) -static constexpr auto IS_BIDIRECTIONAL = false; +static constexpr auto IS_BIDIRECTIONAL = true; // Motor magnet count for RPM calculation static constexpr auto MOTOR01_MAGNET_COUNT = 14; diff --git a/src/DShotRMT.cpp b/src/DShotRMT.cpp index 23fcabb..15df4e9 100644 --- a/src/DShotRMT.cpp +++ b/src/DShotRMT.cpp @@ -62,6 +62,9 @@ DShotRMT::DShotRMT(gpio_num_t gpio, dshot_mode_t mode, bool is_bidirectional) // Pre-calculate timing and bit positions for performance _preCalculateRMTTicks(); _preCalculateBitPositions(); + + // Activate internal pullup resistor + gpio_set_pull_mode(_gpio, GPIO_PULLUP_ONLY); } // Constructor using pin number