diff --git a/components/adc/include/adc_types.hpp b/components/adc/include/adc_types.hpp index 89d3936a4..a69d902ba 100644 --- a/components/adc/include/adc_types.hpp +++ b/components/adc/include/adc_types.hpp @@ -12,7 +12,7 @@ struct AdcConfig { adc_unit_t unit; /**< Which adc unit is this channel associated with, e.g. ADC_UNIT_1. */ adc_channel_t channel; /**< The actual channel, e.g. ADC_CHANNEL_2. */ adc_atten_t - attenuation; /**< The attenuation associated with this channel, e.g. ADC_ATTEN_DB_11. */ + attenuation; /**< The attenuation associated with this channel, e.g. ADC_ATTEN_DB_12. */ }; static bool operator!=(const AdcConfig &lhs, const AdcConfig &rhs) { diff --git a/components/bldc_driver/CMakeLists.txt b/components/bldc_driver/CMakeLists.txt index 958dab252..306babb8b 100644 --- a/components/bldc_driver/CMakeLists.txt +++ b/components/bldc_driver/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES base_component driver) + REQUIRES base_component driver esp_driver_gpio esp_driver_mcpwm) diff --git a/components/bldc_driver/include/bldc_driver.hpp b/components/bldc_driver/include/bldc_driver.hpp index 3db2066f2..0255d0155 100644 --- a/components/bldc_driver/include/bldc_driver.hpp +++ b/components/bldc_driver/include/bldc_driver.hpp @@ -6,6 +6,8 @@ #include "driver/gpio.h" #include "driver/mcpwm_prelude.h" +#include "esp_idf_version.h" +#include "soc/soc_caps.h" #include "base_component.hpp" @@ -260,10 +262,12 @@ class BldcDriver : public BaseComponent { static int GROUP_ID; void init(const Config &config) { +#if defined(SOC_MCPWM_GROUPS) if (GROUP_ID >= SOC_MCPWM_GROUPS) { GROUP_ID = 0; logger_.error("Exceeded max number of MCPWM groups ({}), resetting to 0", SOC_MCPWM_GROUPS); } +#endif configure_enable_gpio(); configure_timer(); configure_operators(); @@ -324,8 +328,10 @@ class BldcDriver : public BaseComponent { gpio_fault_config.gpio_num = (gpio_num_t)gpio_fault_; gpio_fault_config.group_id = GROUP_ID; gpio_fault_config.flags.active_level = 1; // high level means fault, refer to TMC6300 datasheet - gpio_fault_config.flags.pull_down = true; // internally pull down +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) + gpio_fault_config.flags.pull_down = true; // internally pull down gpio_fault_config.flags.io_loop_back = true; // enable loop back to GPIO input +#endif ESP_ERROR_CHECK(mcpwm_new_gpio_fault(&gpio_fault_config, &fault_handle_)); logger_.info("Set brake mode on the fault event"); diff --git a/components/cli/CMakeLists.txt b/components/cli/CMakeLists.txt index dde0c216c..3b904b451 100644 --- a/components/cli/CMakeLists.txt +++ b/components/cli/CMakeLists.txt @@ -1,4 +1,14 @@ +include($ENV{IDF_PATH}/tools/cmake/version.cmake) + +set(cli_requires driver esp_driver_uart esp_driver_usb_serial_jtag vfs logger) + +if(IDF_VERSION_MAJOR GREATER_EQUAL 6) + list(APPEND cli_requires esp_stdio esp_usb_cdc_rom_console) +else() + list(APPEND cli_requires esp_vfs_console) +endif() + idf_component_register( INCLUDE_DIRS "include" "detail/cli/include" SRC_DIRS "src" - REQUIRES driver esp_driver_uart esp_driver_usb_serial_jtag vfs esp_vfs_console logger) + REQUIRES ${cli_requires}) diff --git a/components/cli/include/cli.hpp b/components/cli/include/cli.hpp index 9509b00d3..5d144aabd 100644 --- a/components/cli/include/cli.hpp +++ b/components/cli/include/cli.hpp @@ -15,7 +15,11 @@ #include "esp_vfs_cdcacm.h" #include "esp_vfs_dev.h" + +#include "esp_idf_version.h" +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) #include "esp_vfs_usb_serial_jtag.h" +#endif #include "line_input.hpp" diff --git a/components/encoder/CMakeLists.txt b/components/encoder/CMakeLists.txt index 4e90d84c0..ee92b315d 100644 --- a/components/encoder/CMakeLists.txt +++ b/components/encoder/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register( INCLUDE_DIRS "include" - REQUIRES base_component driver) + REQUIRES base_component driver esp_driver_pcnt) diff --git a/components/esp-box/CMakeLists.txt b/components/esp-box/CMakeLists.txt index 110166c8f..09c5f20d8 100644 --- a/components/esp-box/CMakeLists.txt +++ b/components/esp-box/CMakeLists.txt @@ -1,6 +1,6 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES driver base_component codec display display_drivers i2c input_drivers interrupt gt911 task tt21100 icm42607 + REQUIRES driver esp_driver_i2s base_component codec display display_drivers i2c input_drivers interrupt gt911 task tt21100 icm42607 REQUIRED_IDF_TARGETS "esp32s3" ) diff --git a/components/esp-dsp b/components/esp-dsp index eedf2a508..921baa14c 160000 --- a/components/esp-dsp +++ b/components/esp-dsp @@ -1 +1 @@ -Subproject commit eedf2a50811195224f07f941250a99bf1368d69e +Subproject commit 921baa14ce8120831cdc1ddafb2d1f40ca1ea43f diff --git a/components/esp32-timer-cam/CMakeLists.txt b/components/esp32-timer-cam/CMakeLists.txt index 94c1f4057..2adb331ff 100644 --- a/components/esp32-timer-cam/CMakeLists.txt +++ b/components/esp32-timer-cam/CMakeLists.txt @@ -1,6 +1,6 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES driver adc base_component bm8563 i2c interrupt led math task + REQUIRES driver esp_driver_i2s esp_driver_spi adc base_component bm8563 i2c interrupt led math task REQUIRED_IDF_TARGETS "esp32" ) diff --git a/components/interrupt/CMakeLists.txt b/components/interrupt/CMakeLists.txt index 2d60c96bd..3740dd14e 100644 --- a/components/interrupt/CMakeLists.txt +++ b/components/interrupt/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES driver base_component task) + REQUIRES driver esp_driver_gpio base_component task) diff --git a/components/led/CMakeLists.txt b/components/led/CMakeLists.txt index 8c9da24c9..e812c8089 100644 --- a/components/led/CMakeLists.txt +++ b/components/led/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES base_component driver task) + REQUIRES base_component driver esp_driver_ledc task) diff --git a/components/m5stack-tab5/CMakeLists.txt b/components/m5stack-tab5/CMakeLists.txt index 20e5c74f3..6342405f1 100644 --- a/components/m5stack-tab5/CMakeLists.txt +++ b/components/m5stack-tab5/CMakeLists.txt @@ -1,6 +1,6 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES driver esp_lcd fatfs base_component bmi270 codec display display_drivers gt911 i2c ina226 input_drivers interrupt pi4ioe5v rx8130ce task + REQUIRES driver esp_driver_i2s esp_driver_sdmmc esp_driver_spi esp_lcd fatfs base_component bmi270 codec display display_drivers gt911 i2c ina226 input_drivers interrupt pi4ioe5v rx8130ce task REQUIRED_IDF_TARGETS "esp32p4" ) diff --git a/components/m5stack-tab5/src/video.cpp b/components/m5stack-tab5/src/video.cpp index 872c73b0a..28e2a4666 100644 --- a/components/m5stack-tab5/src/video.cpp +++ b/components/m5stack-tab5/src/video.cpp @@ -1,8 +1,11 @@ #include "m5stack-tab5.hpp" +#include "esp_idf_version.h" + #include #include +#include #include #include #include @@ -91,11 +94,15 @@ bool M5StackTab5::initialize_lcd() { if (lcd_handles_.mipi_dsi_bus == nullptr) { logger_.info("Creating MIPI DSI bus"); esp_lcd_dsi_bus_config_t bus_config = { - .bus_id = 0, - .num_data_lanes = 2, - .phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT, - .lane_bit_rate_mbps = - (uint32_t)(detected_controller == DisplayController::ILI9881 ? 730 : 965), + .bus_id = 0, + .num_data_lanes = 2, + .phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT, + .lane_bit_rate_mbps = +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) + static_cast(detected_controller == DisplayController::ILI9881 ? 730 : 965), +#else + static_cast(detected_controller == DisplayController::ILI9881 ? 730 : 965), +#endif }; ret = esp_lcd_new_dsi_bus(&bus_config, &lcd_handles_.mipi_dsi_bus); if (ret != ESP_OK) { @@ -135,7 +142,12 @@ bool M5StackTab5::initialize_lcd() { dpi_cfg.virtual_channel = 0; dpi_cfg.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT; dpi_cfg.dpi_clock_freq_mhz = 60; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0) + dpi_cfg.in_color_format = LCD_COLOR_FMT_RGB565; + dpi_cfg.out_color_format = LCD_COLOR_FMT_RGB565; +#else dpi_cfg.pixel_format = LCD_COLOR_PIXEL_FORMAT_RGB565; +#endif dpi_cfg.num_fbs = 1; dpi_cfg.video_timing.h_size = display_width_; dpi_cfg.video_timing.v_size = display_height_; @@ -145,13 +157,20 @@ bool M5StackTab5::initialize_lcd() { dpi_cfg.video_timing.vsync_back_porch = 20; dpi_cfg.video_timing.vsync_pulse_width = 4; dpi_cfg.video_timing.vsync_front_porch = 20; +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) dpi_cfg.flags.use_dma2d = true; +#endif } else if (detected_controller == DisplayController::ST7123 && lcd_handles_.panel == nullptr) { dpi_cfg.virtual_channel = 0; dpi_cfg.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT; dpi_cfg.dpi_clock_freq_mhz = 100; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0) + dpi_cfg.in_color_format = LCD_COLOR_FMT_RGB565; + dpi_cfg.out_color_format = LCD_COLOR_FMT_RGB565; +#else dpi_cfg.pixel_format = LCD_COLOR_PIXEL_FORMAT_RGB565; +#endif dpi_cfg.num_fbs = 1; dpi_cfg.video_timing.h_size = display_width_; dpi_cfg.video_timing.v_size = display_height_; @@ -161,7 +180,9 @@ bool M5StackTab5::initialize_lcd() { dpi_cfg.video_timing.vsync_back_porch = 8; dpi_cfg.video_timing.vsync_pulse_width = 2; dpi_cfg.video_timing.vsync_front_porch = 220; +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0) dpi_cfg.flags.use_dma2d = true; +#endif } if (lcd_handles_.panel == nullptr) { diff --git a/components/monitor/src/heap_monitor.cpp b/components/monitor/src/heap_monitor.cpp index 0932e0eb1..2dec92cfe 100644 --- a/components/monitor/src/heap_monitor.cpp +++ b/components/monitor/src/heap_monitor.cpp @@ -1,5 +1,16 @@ #include "heap_monitor.hpp" +#include "esp_idf_version.h" + +// MALLOC_CAP_TCM was renamed to MALLOC_CAP_SPM in ESP-IDF v6.0 +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0) +#define ESPP_MALLOC_CAP_TCM MALLOC_CAP_SPM +#define ESPP_MALLOC_CAP_TCM_NAME "SPM " +#else +#define ESPP_MALLOC_CAP_TCM MALLOC_CAP_TCM +#define ESPP_MALLOC_CAP_TCM_NAME "TCM " +#endif + using namespace espp; std::string HeapMonitor::get_region_name(int heap_flags) { @@ -25,8 +36,8 @@ std::string HeapMonitor::get_region_name(int heap_flags) { if (heap_flags & MALLOC_CAP_RTCRAM) { name += "RTCRAM "; } - if (heap_flags & MALLOC_CAP_TCM) { - name += "TCM "; + if (heap_flags & ESPP_MALLOC_CAP_TCM) { + name += ESPP_MALLOC_CAP_TCM_NAME; } if (heap_flags & MALLOC_CAP_DMA_DESC_AHB) { name += "DMA AHB "; diff --git a/components/motorgo-mini/CMakeLists.txt b/components/motorgo-mini/CMakeLists.txt index 4fd247e6d..68fb249ca 100644 --- a/components/motorgo-mini/CMakeLists.txt +++ b/components/motorgo-mini/CMakeLists.txt @@ -1,6 +1,6 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES base_component interrupt filters led math mt6701 pid task bldc_driver bldc_motor i2c adc + REQUIRES base_component interrupt filters led math mt6701 pid task bldc_driver bldc_motor i2c adc esp_driver_spi REQUIRED_IDF_TARGETS "esp32s3" ) diff --git a/components/motorgo-mini/src/motorgo-mini.cpp b/components/motorgo-mini/src/motorgo-mini.cpp index f146fa25b..1efcbe936 100644 --- a/components/motorgo-mini/src/motorgo-mini.cpp +++ b/components/motorgo-mini/src/motorgo-mini.cpp @@ -208,16 +208,11 @@ float MotorGoMini::breathe(float breathing_period, uint64_t start_us, bool resta bool IRAM_ATTR MotorGoMini::read_encoder(const auto &encoder_handle, uint8_t *data, size_t size) { static constexpr uint8_t SPIBUS_READ = 0x80; - spi_transaction_t t = { - .flags = 0, - .cmd = 0, - .addr = SPIBUS_READ, - .length = size * 8, - .rxlength = size * 8, - .user = nullptr, - .tx_buffer = nullptr, - .rx_buffer = data, - }; + spi_transaction_t t{}; + t.addr = SPIBUS_READ; + t.length = size * 8; + t.rxlength = size * 8; + t.rx_buffer = data; if (size <= 4) { t.flags = SPI_TRANS_USE_RXDATA; t.rx_buffer = nullptr; diff --git a/components/mt6701/example/CMakeLists.txt b/components/mt6701/example/CMakeLists.txt index 290570849..041db1485 100644 --- a/components/mt6701/example/CMakeLists.txt +++ b/components/mt6701/example/CMakeLists.txt @@ -12,7 +12,7 @@ set(EXTRA_COMPONENT_DIRS set( COMPONENTS - "main esptool_py driver filters i2c task mt6701" + "main esptool_py driver esp_driver_spi filters i2c task mt6701" CACHE STRING "List of components to include" ) diff --git a/components/neopixel/CMakeLists.txt b/components/neopixel/CMakeLists.txt index 520f47b74..356220cc0 100644 --- a/components/neopixel/CMakeLists.txt +++ b/components/neopixel/CMakeLists.txt @@ -1,5 +1,5 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES base_component color rmt + REQUIRES base_component color esp_driver_gpio rmt ) diff --git a/components/remote_debug/CMakeLists.txt b/components/remote_debug/CMakeLists.txt index bd6b97c6b..d156de9b9 100644 --- a/components/remote_debug/CMakeLists.txt +++ b/components/remote_debug/CMakeLists.txt @@ -1,5 +1,5 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES esp_http_server driver adc base_component file_system timer + REQUIRES esp_http_server driver esp_driver_gpio adc base_component file_system timer ) diff --git a/components/rmt/CMakeLists.txt b/components/rmt/CMakeLists.txt index a069fc182..a13314281 100644 --- a/components/rmt/CMakeLists.txt +++ b/components/rmt/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register( INCLUDE_DIRS "include" - REQUIRES base_component driver + REQUIRES base_component driver esp_driver_rmt ) diff --git a/components/socket/src/socket.cpp b/components/socket/src/socket.cpp index e6265c0e1..83df9d1bd 100644 --- a/components/socket/src/socket.cpp +++ b/components/socket/src/socket.cpp @@ -127,7 +127,7 @@ bool Socket::set_receive_timeout(const std::chrono::duration &timeout) { return true; } float intpart; - float fractpart = modf(seconds, &intpart); + float fractpart = modff(seconds, &intpart); const time_t response_timeout_s = (int)intpart; const time_t response_timeout_us = (int)(fractpart * 1E6); //// Alternatively we could do this: diff --git a/components/state_machine/example/main/Complex_generated_states.cpp b/components/state_machine/example/main/Complex_generated_states.cpp index 48b26ea96..d176f7c58 100644 --- a/components/state_machine/example/main/Complex_generated_states.cpp +++ b/components/state_machine/example/main/Complex_generated_states.cpp @@ -867,8 +867,6 @@ bool Root::State_2::ChildState3::Grand2::handleEvent(GeneratedEventBase *event) // take care of all event types that this branch will not handle - // for more consistent run-time performnace switch (event->get_type()) { - handled = true; - break; default: handled = false; break; @@ -1631,8 +1629,6 @@ bool Root::State3::ChildState::handleEvent(GeneratedEventBase *event) { // take care of all event types that this branch will not handle - // for more consistent run-time performnace switch (event->get_type()) { - handled = true; - break; default: handled = false; break; diff --git a/components/t-deck/CMakeLists.txt b/components/t-deck/CMakeLists.txt index 08a1d816a..1a70a27c3 100644 --- a/components/t-deck/CMakeLists.txt +++ b/components/t-deck/CMakeLists.txt @@ -2,6 +2,6 @@ idf_component_register( INCLUDE_DIRS "include" SRC_DIRS "src" - REQUIRES driver base_component display display_drivers fatfs i2c input_drivers interrupt gt911 task t_keyboard + REQUIRES driver esp_driver_i2s esp_driver_spi base_component display display_drivers fatfs i2c input_drivers interrupt gt911 task t_keyboard REQUIRED_IDF_TARGETS "esp32s3" ) diff --git a/components/thermistor/example/main/thermistor_example.cpp b/components/thermistor/example/main/thermistor_example.cpp index b00a3cefb..927299649 100644 --- a/components/thermistor/example/main/thermistor_example.cpp +++ b/components/thermistor/example/main/thermistor_example.cpp @@ -75,7 +75,7 @@ extern "C" void app_main(void) { // create a continuous ADC which will sample and filter the thermistor // voltage on ADC1 channel 7 std::vector channels{ - {.unit = ADC_UNIT_1, .channel = ADC_CHANNEL_7, .attenuation = ADC_ATTEN_DB_11}}; + {.unit = ADC_UNIT_1, .channel = ADC_CHANNEL_7, .attenuation = ADC_ATTEN_DB_12}}; // this initailizes the DMA and filter task for the continuous adc espp::ContinuousAdc adc( {.sample_rate_hz = 20 * 1000, diff --git a/components/ws-s3-touch/example/main/ws_s3_touch_example.cpp b/components/ws-s3-touch/example/main/ws_s3_touch_example.cpp index 774714168..4f9bf85f5 100644 --- a/components/ws-s3-touch/example/main/ws_s3_touch_example.cpp +++ b/components/ws-s3-touch/example/main/ws_s3_touch_example.cpp @@ -115,14 +115,15 @@ extern "C" void app_main(void) { return; } // now set the time on the RTC - std::tm timeinfo{ - .tm_sec = 0, - .tm_min = 42, - .tm_hour = 13, - .tm_mday = 24, - .tm_mon = 10, // 0-11, so 10 is November - .tm_year = 123 // years since 1900, so 100 is 2000 - }; + std::tm timeinfo{}; + timeinfo.tm_sec = 0; + timeinfo.tm_min = 42; + timeinfo.tm_hour = 13; + timeinfo.tm_mday = 24; + timeinfo.tm_mon = 10; // 0-11, so 10 is November + timeinfo.tm_year = 2023 - 1900; // years since 1900 + std::mktime(&timeinfo); + std::error_code ec; bsp.rtc()->set_time(timeinfo, ec); if (ec) {