diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb101fe..56d68bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,6 @@ jobs: - name: Build Examples uses: espressif/esp-idf-ci-action@v1 with: - esp_idf_version: release-v5.2 + esp_idf_version: v5.2.2 target: esp32s3 path: '.' diff --git a/.github/workflows/package_main.yml b/.github/workflows/package_main.yml index cb0e32a..190feaf 100644 --- a/.github/workflows/package_main.yml +++ b/.github/workflows/package_main.yml @@ -21,7 +21,7 @@ jobs: - name: Build Main Code uses: espressif/esp-idf-ci-action@v1 with: - esp_idf_version: release-v5.2 + esp_idf_version: v5.2.2 target: esp32s3 path: '.' command: 'idf.py build' diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fbffed..2ed98dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,9 +11,21 @@ set(EXTRA_COMPONENT_DIRS "components/esp-protocols/components" ) +# set the hal component to use based on the target +if(IDF_TARGET STREQUAL "esp32") + #append the components that we want to use + set(HAL_COMPONENTS "wrover-kit") + message(WARNING "ESP32 target, using components: ${HAL_COMPONENTS}") +elseif(IDF_TARGET STREQUAL "esp32s3") + set(HAL_COMPONENTS "t-deck esp-box") + message(WARNING "ESP32-S3 target, using components: ${HAL_COMPONENTS}") +else() + message(FATAL_ERROR "Unsupported target: ${IDF_TARGET}") +endif() + set( COMPONENTS - "main esptool_py driver lwip button display display_drivers input_drivers logger lvgl mdns socket task tt21100 gt911 wifi gui i2c" + "main esptool_py driver lwip button logger lvgl mdns socket task wifi gui nvs ${HAL_COMPONENTS}" CACHE STRING "List of components to include" ) diff --git a/components/esp-protocols b/components/esp-protocols index 38a3631..25d8423 160000 --- a/components/esp-protocols +++ b/components/esp-protocols @@ -1 +1 @@ -Subproject commit 38a3631a27f71f25109f1d6e28d3c2ba309f292d +Subproject commit 25d8423e6dd9031d4bd5a3afe815810137d4532b diff --git a/components/espp b/components/espp index 761b524..a93e6a7 160000 --- a/components/espp +++ b/components/espp @@ -1 +1 @@ -Subproject commit 761b52412c903319f06e66f66696e5ac29ded285 +Subproject commit a93e6a7d095b076c44df26646b12eafc0e75a740 diff --git a/dependencies.lock b/dependencies.lock new file mode 100644 index 0000000..9f52290 --- /dev/null +++ b/dependencies.lock @@ -0,0 +1,9 @@ +dependencies: + idf: + component_hash: null + source: + type: idf + version: 5.2.2 +manifest_hash: 3b2f19acb78af92ba73aad159d4776bc678f2d95005e555536493d6d06488be2 +target: esp32s3 +version: 1.0.0 diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index 718ab39..3bb4d5f 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -6,12 +6,13 @@ menu "Wireless Debug Display Configuration" help Select the dev-kit / hardware you're using. config HARDWARE_WROVER_KIT + depends on IDF_TARGET_ESP32 bool "ESP32 WROVER KIT V4" config HARDWARE_BOX - bool "ESP BOX" - config HARDWARE_BOX_3 - bool "ESP BOX 3" + depends on IDF_TARGET_ESP32S3 + bool "ESP BOX (ESP32-S3-BOX or ESP32-S3-BOX-3)" config HARDWARE_TDECK + depends on IDF_TARGET_ESP32S3 bool "LILYGO T DECK" endchoice diff --git a/main/box.hpp b/main/box.hpp deleted file mode 100644 index 63af67b..0000000 --- a/main/box.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include "i2c.hpp" -#include "st7789.hpp" -#include "touchpad_input.hpp" -#include "tt21100.hpp" -static constexpr int DC_PIN_NUM = 4; - -static constexpr std::string_view dev_kit = "ESP32-S3-BOX"; -static constexpr gpio_num_t i2c_sda = GPIO_NUM_8; -static constexpr gpio_num_t i2c_scl = GPIO_NUM_18; -static constexpr bool touch_swap_xy = false; -static constexpr int clock_speed = 60 * 1000 * 1000; -static constexpr auto spi_num = SPI2_HOST; -static constexpr gpio_num_t mosi = GPIO_NUM_6; -static constexpr gpio_num_t sclk = GPIO_NUM_7; -static constexpr gpio_num_t spics = GPIO_NUM_5; -static constexpr gpio_num_t reset = GPIO_NUM_48; -static constexpr gpio_num_t dc_pin = (gpio_num_t)DC_PIN_NUM; -static constexpr gpio_num_t backlight = GPIO_NUM_45; -static constexpr size_t width = 320; -static constexpr size_t height = 240; -static constexpr size_t pixel_buffer_size = width * 50; -static constexpr bool backlight_value = true; -static constexpr bool reset_value = false; -static constexpr bool invert_colors = true; -static constexpr auto rotation = espp::Display::Rotation::LANDSCAPE; -static constexpr bool mirror_x = true; -static constexpr bool mirror_y = true; -static constexpr bool touch_invert_x = true; -static constexpr bool touch_invert_y = false; - -using DisplayDriver = espp::St7789; diff --git a/main/box_3.hpp b/main/box_3.hpp deleted file mode 100644 index 2d3e827..0000000 --- a/main/box_3.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include "gt911.hpp" -#include "i2c.hpp" -#include "ili9341.hpp" -#include "st7789.hpp" -#include "touchpad_input.hpp" -#include "tt21100.hpp" -static constexpr int DC_PIN_NUM = 4; - -static constexpr std::string_view dev_kit = "ESP32-S3-BOX-3"; -static constexpr gpio_num_t i2c_sda = GPIO_NUM_8; -static constexpr gpio_num_t i2c_scl = GPIO_NUM_18; -static constexpr int clock_speed = 60 * 1000 * 1000; -static constexpr auto spi_num = SPI2_HOST; -static constexpr gpio_num_t mosi = GPIO_NUM_6; -static constexpr gpio_num_t sclk = GPIO_NUM_7; -static constexpr gpio_num_t spics = GPIO_NUM_5; -static constexpr gpio_num_t reset = GPIO_NUM_48; -static constexpr gpio_num_t dc_pin = (gpio_num_t)DC_PIN_NUM; -static constexpr gpio_num_t backlight = GPIO_NUM_47; -static constexpr size_t width = 320; -static constexpr size_t height = 240; -static constexpr size_t pixel_buffer_size = width * 50; -static constexpr bool backlight_value = true; -static constexpr bool reset_value = true; -static constexpr bool invert_colors = true; -static constexpr auto rotation = espp::Display::Rotation::LANDSCAPE; -static constexpr bool mirror_x = true; -static constexpr bool mirror_y = true; -static constexpr bool touch_swap_xy = false; -static constexpr bool touch_invert_x = false; -static constexpr bool touch_invert_y = false; - -using DisplayDriver = espp::St7789; diff --git a/main/main.cpp b/main/main.cpp index 344390b..dd143ea 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -3,27 +3,23 @@ #include #include -#include -#include #include -#if CONFIG_ESP32_WIFI_NVS_ENABLED -#include -#endif - -#include "display.hpp" #if CONFIG_HARDWARE_WROVER_KIT -#include "wrover_kit.hpp" +#include "wrover-kit.hpp" #elif CONFIG_HARDWARE_BOX -#include "box.hpp" -#elif CONFIG_HARDWARE_BOX_3 -#include "box_3.hpp" +#include "esp-box.hpp" #elif CONFIG_HARDWARE_TDECK -#include "tdeck.hpp" +#include "t-deck.hpp" #else #error "Misconfigured hardware!" #endif +#if CONFIG_ESP32_WIFI_NVS_ENABLED +#include "nvs.hpp" +#endif + +#include "button.hpp" #include "gui.hpp" #include "logger.hpp" #include "task.hpp" @@ -33,210 +29,42 @@ using namespace std::chrono_literals; -static spi_device_handle_t spi; -static const int spi_queue_size = 7; -static size_t num_queued_trans = 0; - -// the user flag for the callbacks does two things: -// 1. Provides the GPIO level for the data/command pin, and -// 2. Sets some bits for other signaling (such as LVGL FLUSH) -static constexpr int FLUSH_BIT = (1 << (int)espp::display_drivers::Flags::FLUSH_BIT); -static constexpr int DC_LEVEL_BIT = (1 << (int)espp::display_drivers::Flags::DC_LEVEL_BIT); - -// This function is called (in irq context!) just before a transmission starts. -// It will set the D/C line to the value indicated in the user field -// (DC_LEVEL_BIT). -static void IRAM_ATTR lcd_spi_pre_transfer_callback(spi_transaction_t *t) { - uint32_t user_flags = (uint32_t)(t->user); - bool dc_level = user_flags & DC_LEVEL_BIT; - gpio_set_level((gpio_num_t)DC_PIN_NUM, dc_level); -} - -// This function is called (in irq context!) just after a transmission ends. It -// will indicate to lvgl that the next flush is ready to be done if the -// FLUSH_BIT is set. -static void IRAM_ATTR lcd_spi_post_transfer_callback(spi_transaction_t *t) { - uint16_t user_flags = (uint32_t)(t->user); - bool should_flush = user_flags & FLUSH_BIT; - if (should_flush) { - lv_disp_t *disp = _lv_refr_get_disp_refreshing(); - lv_disp_flush_ready(disp->driver); - } -} - -extern "C" void IRAM_ATTR lcd_write(const uint8_t *data, size_t length, uint32_t user_data) { - if (length == 0) { - return; - } - static spi_transaction_t t; - memset(&t, 0, sizeof(t)); - t.length = length * 8; - t.tx_buffer = data; - t.user = (void *)user_data; - spi_device_polling_transmit(spi, &t); -} - -static void lcd_wait_lines() { - spi_transaction_t *rtrans; - esp_err_t ret; - // Wait for all transactions to be done and get back the results. - while (num_queued_trans) { - // fmt::print("Waiting for {} lines\n", num_queued_trans); - ret = spi_device_get_trans_result(spi, &rtrans, portMAX_DELAY); - if (ret != ESP_OK) { - fmt::print("Could not get trans result: {} '{}'\n", ret, esp_err_to_name(ret)); - } - num_queued_trans--; - // We could inspect rtrans now if we received any info back. The LCD is treated as write-only, - // though. - } -} - -void IRAM_ATTR lcd_send_lines(int xs, int ys, int xe, int ye, const uint8_t *data, - uint32_t user_data) { - // if we haven't waited by now, wait here... - lcd_wait_lines(); - esp_err_t ret; - // Transaction descriptors. Declared static so they're not allocated on the stack; we need this - // memory even when this function is finished because the SPI driver needs access to it even while - // we're already calculating the next line. - static spi_transaction_t trans[6]; - // In theory, it's better to initialize trans and data only once and hang on to the initialized - // variables. We allocate them on the stack, so we need to re-init them each call. - for (int i = 0; i < 6; i++) { - memset(&trans[i], 0, sizeof(spi_transaction_t)); - if ((i & 1) == 0) { - // Even transfers are commands - trans[i].length = 8; - trans[i].user = (void *)0; - } else { - // Odd transfers are data - trans[i].length = 8 * 4; - trans[i].user = (void *)DC_LEVEL_BIT; - } - trans[i].flags = SPI_TRANS_USE_TXDATA; - } - size_t length = (xe - xs + 1) * (ye - ys + 1) * 2; - trans[0].tx_data[0] = (uint8_t)DisplayDriver::Command::caset; - trans[1].tx_data[0] = (xs) >> 8; - trans[1].tx_data[1] = (xs)&0xff; - trans[1].tx_data[2] = (xe) >> 8; - trans[1].tx_data[3] = (xe)&0xff; - trans[2].tx_data[0] = (uint8_t)DisplayDriver::Command::raset; - trans[3].tx_data[0] = (ys) >> 8; - trans[3].tx_data[1] = (ys)&0xff; - trans[3].tx_data[2] = (ye) >> 8; - trans[3].tx_data[3] = (ye)&0xff; - trans[4].tx_data[0] = (uint8_t)DisplayDriver::Command::ramwr; - trans[5].tx_buffer = data; - trans[5].length = length * 8; - // undo SPI_TRANS_USE_TXDATA flag - trans[5].flags = 0; - // we need to keep the dc bit set, but also add our flags - trans[5].user = (void *)(DC_LEVEL_BIT | user_data); - // Queue all transactions. - for (int i = 0; i < 6; i++) { - ret = spi_device_queue_trans(spi, &trans[i], portMAX_DELAY); - if (ret != ESP_OK) { - fmt::print("Couldn't queue trans: {} '{}'\n", ret, esp_err_to_name(ret)); - } else { - num_queued_trans++; - } - } - // When we are here, the SPI driver is busy (in the background) getting the - // transactions sent. That happens mostly using DMA, so the CPU doesn't have - // much to do here. We're not going to wait for the transaction to finish - // because we may as well spend the time calculating the next line. When that - // is done, we can call send_line_finish, which will wait for the transfers - // to be done and check their status. -} - extern "C" void app_main(void) { - static auto start = std::chrono::high_resolution_clock::now(); - static auto elapsed = [&]() { - auto now = std::chrono::high_resolution_clock::now(); - return std::chrono::duration(now - start).count(); - }; - espp::Logger logger({.tag = "WirelessDebugDisplay", .level = espp::Logger::Verbosity::INFO}); - logger.info("Bootup"); #if CONFIG_ESP32_WIFI_NVS_ENABLED // initialize NVS, needed for WiFi - esp_err_t ret = nvs_flash_init(); - if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { - logger.warn("Erasing NVS flash..."); - ESP_ERROR_CHECK(nvs_flash_erase()); - ret = nvs_flash_init(); - } - ESP_ERROR_CHECK(ret); + std::error_code ec; + espp::Nvs nvs; + nvs.init(ec); #endif // hardware specific configuration #if CONFIG_HARDWARE_WROVER_KIT + auto &hal = espp::WroverKit::get(); #endif #if CONFIG_HARDWARE_BOX + auto &hal = espp::EspBox::get(); #endif #if CONFIG_HARDWARE_TDECK - // peripheral power on t-deck requires the power pin to be set (gpio 10) - // so set up gpio output and set it high - gpio_num_t BOARD_POWER_ON_PIN = GPIO_NUM_10; - gpio_set_direction(BOARD_POWER_ON_PIN, GPIO_MODE_OUTPUT); - gpio_set_level(BOARD_POWER_ON_PIN, 1); - - gpio_num_t KEYBOARD_INTERRUPT_PIN = GPIO_NUM_46; - gpio_set_direction(KEYBOARD_INTERRUPT_PIN, GPIO_MODE_INPUT); + auto &hal = espp::TDeck::get(); #endif - logger.info("Initializing display drivers for {}", dev_kit); - // create the spi host - spi_bus_config_t buscfg; - memset(&buscfg, 0, sizeof(buscfg)); - buscfg.mosi_io_num = mosi; - buscfg.miso_io_num = -1; - buscfg.sclk_io_num = sclk; - buscfg.quadwp_io_num = -1; - buscfg.quadhd_io_num = -1; - buscfg.max_transfer_sz = (int)(pixel_buffer_size * sizeof(lv_color_t)); - // create the spi device - spi_device_interface_config_t devcfg; - memset(&devcfg, 0, sizeof(devcfg)); - devcfg.mode = 0; - devcfg.clock_speed_hz = clock_speed; - devcfg.input_delay_ns = 0; - devcfg.spics_io_num = spics; - devcfg.queue_size = spi_queue_size; - devcfg.pre_cb = lcd_spi_pre_transfer_callback; - devcfg.post_cb = lcd_spi_post_transfer_callback; + hal.set_log_level(espp::Logger::Verbosity::INFO); - // Initialize the SPI bus - ret = spi_bus_initialize(spi_num, &buscfg, SPI_DMA_CH_AUTO); - ESP_ERROR_CHECK(ret); - // Attach the LCD to the SPI bus - ret = spi_bus_add_device(spi_num, &devcfg, &spi); - ESP_ERROR_CHECK(ret); - // initialize the controller - DisplayDriver::initialize(espp::display_drivers::Config{ - .lcd_write = lcd_write, - .lcd_send_lines = lcd_send_lines, - .reset_pin = reset, - .data_command_pin = dc_pin, - .reset_value = reset_value, - .invert_colors = invert_colors, - .mirror_x = mirror_x, - .mirror_y = mirror_y, - }); - // initialize the display / lvgl - auto display = std::make_shared( - espp::Display::AllocatingConfig{.width = width, - .height = height, - .pixel_buffer_size = pixel_buffer_size, - .flush_callback = DisplayDriver::flush, - .backlight_pin = backlight, - .backlight_on_value = backlight_value, - .rotation = rotation, - .software_rotation_enabled = true}); + if (!hal.initialize_lcd()) { + logger.error("Could not initialize LCD"); + return; + } + // initialize the display, using a pixel buffer of 50 lines + static constexpr size_t pixel_buffer_size = hal.lcd_width() * 50; + if (!hal.initialize_display(pixel_buffer_size)) { + logger.error("Could not initialize display"); + return; + } + + auto display = hal.display(); // create the gui Gui gui({.display = display, .log_level = espp::Logger::Verbosity::DEBUG}); @@ -244,65 +72,36 @@ extern "C" void app_main(void) { // initialize the input system #if CONFIG_HARDWARE_WROVER_KIT espp::Button button({ - .gpio_num = GPIO_NUM_0, - .callback = [&](const espp::Button::Event &event) { gui.switch_tab(); }, - .active_level = espp::Button::ActiveLevel::LOW, - .interrupt_type = espp::Button::InterruptType::RISING_EDGE, - .pullup_enabled = false, - .pulldown_enabled = false, + .interrupt_config = + { + .gpio_num = GPIO_NUM_0, + .callback = [&](const espp::Button::Event &event) { gui.switch_tab(); }, + .active_level = espp::Button::ActiveLevel::LOW, + .interrupt_type = espp::Button::InterruptType::RISING_EDGE, + .pullup_enabled = false, + .pulldown_enabled = false, + }, .log_level = espp::Logger::Verbosity::WARN, }); #endif -#if CONFIG_HARDWARE_BOX || CONFIG_HARDWARE_BOX_3 || CONFIG_HARDWARE_TDECK - // initialize the i2c bus to read the touchpad driver - espp::I2c i2c({ - .port = I2C_NUM_0, - .sda_io_num = i2c_sda, - .scl_io_num = i2c_scl, - .sda_pullup_en = GPIO_PULLUP_ENABLE, - .scl_pullup_en = GPIO_PULLUP_ENABLE, - .clk_speed = 400 * 1000, - }); - - // probe for the touch devices: - // tt21100, gt911 - bool has_tt21100 = false; - bool has_gt911 = false; - has_tt21100 = i2c.probe_device(0x24); - has_gt911 = i2c.probe_device(0x5d) | i2c.probe_device(0x14); - logger.info("Touchpad probe results: tt21100: {}, gt911: {}", has_tt21100, has_gt911); - -#if CONFIG_HARDWARE_BOX - logger.info("Initializing Tt21100"); - using TouchDriver = espp::Tt21100; -#endif -#if CONFIG_HARDWARE_TDECK || CONFIG_HARDWARE_BOX_3 - logger.info("Initializing GT911"); - using TouchDriver = espp::Gt911; - // implement GT911 -#endif - TouchDriver touch({.write = std::bind(&espp::I2c::write, &i2c, std::placeholders::_1, - std::placeholders::_2, std::placeholders::_3), - .read = std::bind(&espp::I2c::read, &i2c, std::placeholders::_1, - std::placeholders::_2, std::placeholders::_3)}); - - auto touchpad_read = [&touch](uint8_t *num_touch_points, uint16_t *x, uint16_t *y, - uint8_t *btn_state) { - std::error_code ec; - *num_touch_points = 0; - // get the latest data from the device - if (touch.update(ec) && !ec) { - touch.get_touch_point(num_touch_points, x, y); - } - *btn_state = touch.get_home_button_state(); +#if CONFIG_HARDWARE_BOX || CONFIG_HARDWARE_TDECK + if (!hal.initialize_touch()) { + logger.error("Could not initialize touch"); + return; + } + // make a task to run the touch update + auto touch_task_config = espp::Task::Config{ + .name = "TouchTask", + .callback = + [&](auto &m, auto &cv) { + hal.update_touch(); + std::this_thread::sleep_for(10ms); + return false; + }, + .stack_size_bytes = 6 * 1024, }; - logger.info("Initializing touchpad"); - auto touchpad = - espp::TouchpadInput(espp::TouchpadInput::Config{.touchpad_read = touchpad_read, - .swap_xy = touch_swap_xy, - .invert_x = touch_invert_x, - .invert_y = touch_invert_y, - .log_level = espp::Logger::Verbosity::WARN}); + espp::Task touch_task(touch_task_config); + touch_task.start(); #endif // initialize WiFi @@ -350,6 +149,7 @@ extern "C" void app_main(void) { } } ; + server_socket.start_receiving(server_task_config, server_config); // initialize mDNS, so that other embedded devices on the network can find us diff --git a/main/tdeck.hpp b/main/tdeck.hpp deleted file mode 100644 index 739c97f..0000000 --- a/main/tdeck.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include "gt911.hpp" -#include "i2c.hpp" -#include "st7789.hpp" -#include "touchpad_input.hpp" -static constexpr int DC_PIN_NUM = 11; - -static constexpr std::string_view dev_kit = "LILYGO T-DECK"; -static constexpr gpio_num_t i2c_sda = GPIO_NUM_18; -static constexpr gpio_num_t i2c_scl = GPIO_NUM_8; -static constexpr bool touch_swap_xy = true; -static constexpr int clock_speed = 40 * 1000 * 1000; -static constexpr auto spi_num = SPI2_HOST; -static constexpr gpio_num_t mosi = GPIO_NUM_41; -static constexpr gpio_num_t sclk = GPIO_NUM_40; -static constexpr gpio_num_t spics = GPIO_NUM_12; -static constexpr gpio_num_t reset = - GPIO_NUM_NC; // not connected according to Setup210_LilyGo_T_Deck.h -static constexpr gpio_num_t dc_pin = (gpio_num_t)DC_PIN_NUM; -static constexpr gpio_num_t backlight = GPIO_NUM_42; -static constexpr size_t width = 320; -static constexpr size_t height = 240; -static constexpr size_t pixel_buffer_size = width * 50; -static constexpr bool backlight_value = true; -static constexpr bool reset_value = false; -static constexpr bool invert_colors = false; -static constexpr auto rotation = espp::Display::Rotation::LANDSCAPE_INVERTED; -static constexpr bool mirror_x = true; -static constexpr bool mirror_y = true; -static constexpr bool touch_invert_x = true; -static constexpr bool touch_invert_y = false; - -using DisplayDriver = espp::St7789; diff --git a/main/wrover_kit.hpp b/main/wrover_kit.hpp deleted file mode 100644 index 324082e..0000000 --- a/main/wrover_kit.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "button.hpp" -#include "ili9341.hpp" -static constexpr int DC_PIN_NUM = 21; - -static constexpr std::string_view dev_kit = "ESP-WROVER-DevKit"; -static constexpr int clock_speed = 20 * 1000 * 1000; -static constexpr auto spi_num = SPI2_HOST; -static constexpr gpio_num_t mosi = GPIO_NUM_23; -static constexpr gpio_num_t sclk = GPIO_NUM_19; -static constexpr gpio_num_t spics = GPIO_NUM_22; -static constexpr gpio_num_t reset = GPIO_NUM_18; -static constexpr gpio_num_t dc_pin = (gpio_num_t)DC_PIN_NUM; -static constexpr gpio_num_t backlight = GPIO_NUM_5; -static constexpr size_t width = 320; -static constexpr size_t height = 240; -static constexpr size_t pixel_buffer_size = 16384; -static constexpr bool backlight_value = false; -static constexpr bool reset_value = false; -static constexpr bool invert_colors = false; -static auto rotation = espp::Display::Rotation::LANDSCAPE; -static constexpr bool mirror_x = false; -static constexpr bool mirror_y = false; - -using DisplayDriver = espp::Ili9341; diff --git a/sdkconfig.defaults b/sdkconfig.defaults index 37c1b17..fe94567 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -1,29 +1,24 @@ -# TODO: uncomment one of these if you want to support a specifc target by default -# CONFIG_IDF_TARGET="esp32" -# CONFIG_IDF_TARGET="esp32s2" -# CONFIG_IDF_TARGET="esp32s3" -# CONFIG_IDF_TARGET="esp32c3" - -# TODO: uncomment if you want freertos to run at 1 khz instead of the default 100 hz CONFIG_FREERTOS_HZ=1000 -# TODO: uncomment if you want to run the esp at max clock speed (240 mhz) +# set compiler optimization level to -O2 (compile for performance) +CONFIG_COMPILER_OPTIMIZATION_PERF=y + # ESP32-specific # CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=240 -# TODO: uncomment if you want to update the event and main task stask sizes # Common ESP-related # CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4096 CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 -# TODO: uncomment if you want to enable exceptions (which may be needed by certain components such as cli) -# CONFIG_COMPILER_CXX_EXCEPTIONS=y - CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESPTOOLPY_FLASHSIZE="4MB" +CONFIG_ESPTOOLPY_FLASHMODE_QIO=y # over twice as fast as DIO + +# set the functions into IRAM +CONFIG_SPI_MASTER_IN_IRAM=y # # Partition Table