SD card support for 2432S024C and some fixes (#24)

- Implemented SD card support for Yellow Board 2432S024C
- Fix for locking bug when showing gui keyboard
- T-Deck driver naming fixes
- Loader tag name consistency improvement
This commit is contained in:
Ken Van Hoeylandt 2024-01-28 21:52:05 +01:00 committed by GitHub
parent d27579848a
commit ddf46b07e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 259 additions and 100 deletions

View File

@ -41,7 +41,7 @@ Predefined configurations are available for:
|------------------------------------------|--------------|---------|----------| |------------------------------------------|--------------|---------|----------|
| [LilyGo T-Deck][tdeck] | ✅ | ✅ | Keyboard | | [LilyGo T-Deck][tdeck] | ✅ | ✅ | Keyboard |
| [Waveshare S3 Touch][waveshare_s3_touch] | ✅ | ⏳ | | | [Waveshare S3 Touch][waveshare_s3_touch] | ✅ | ⏳ | |
| Yellow Board 2432S024C (\*) | ✅ | | | | Yellow Board 2432S024C (\*) | ✅ | | |
- ✅: Capable and implemented - ✅: Capable and implemented
- ⏳: Capable but not yet implemented - ⏳: Capable but not yet implemented

View File

@ -55,7 +55,7 @@
#define TDECK_SDCARD_FORMAT_ON_MOUNT_FAILED false #define TDECK_SDCARD_FORMAT_ON_MOUNT_FAILED false
#define TDECK_SDCARD_MAX_OPEN_FILES 4 #define TDECK_SDCARD_MAX_OPEN_FILES 4
#define TDECK_SDCARD_ALLOC_UNIT_SIZE (16 * 1024) #define TDECK_SDCARD_ALLOC_UNIT_SIZE (16 * 1024)
#define TDECK_SDCARD_STATUS_CHECK_ENALBED false #define TDECK_SDCARD_STATUS_CHECK_ENABLED false
// Keyboard // Keyboard
#define TDECK_KEYBOARD_I2C_BUS_HANDLE TDECK_I2C_BUS_HANDLE #define TDECK_KEYBOARD_I2C_BUS_HANDLE TDECK_I2C_BUS_HANDLE

View File

@ -4,7 +4,7 @@
bool tdeck_bootstrap(); bool tdeck_bootstrap();
bool tdeck_init_lvgl(); bool tdeck_init_lvgl();
extern SdCard tdeck_sdcard; extern const SdCard tdeck_sdcard;
const HardwareConfig lilygo_tdeck = { const HardwareConfig lilygo_tdeck = {
.bootstrap = &tdeck_bootstrap, .bootstrap = &tdeck_bootstrap,

View File

@ -61,7 +61,7 @@ static void* sdcard_mount(const char* mount_point) {
.format_if_mount_failed = TDECK_SDCARD_FORMAT_ON_MOUNT_FAILED, .format_if_mount_failed = TDECK_SDCARD_FORMAT_ON_MOUNT_FAILED,
.max_files = TDECK_SDCARD_MAX_OPEN_FILES, .max_files = TDECK_SDCARD_MAX_OPEN_FILES,
.allocation_unit_size = TDECK_SDCARD_ALLOC_UNIT_SIZE, .allocation_unit_size = TDECK_SDCARD_ALLOC_UNIT_SIZE,
.disk_status_check_enable = TDECK_SDCARD_STATUS_CHECK_ENALBED .disk_status_check_enable = TDECK_SDCARD_STATUS_CHECK_ENABLED
}; };
sdmmc_card_t* card; sdmmc_card_t* card;
@ -125,7 +125,7 @@ static void sdcard_unmount(void* context) {
free(data); free(data);
} }
SdCard tdeck_sdcard = { const SdCard tdeck_sdcard = {
.mount = &sdcard_init_and_mount, .mount = &sdcard_init_and_mount,
.unmount = &sdcard_unmount, .unmount = &sdcard_unmount,
.mount_behaviour = SDCARD_MOUNT_BEHAVIOUR_AT_BOOT .mount_behaviour = SDCARD_MOUNT_BEHAVIOUR_AT_BOOT

View File

@ -1,7 +1,7 @@
idf_component_register( idf_component_register(
SRC_DIRS "." SRC_DIRS "."
INCLUDE_DIRS "." INCLUDE_DIRS "."
REQUIRES esp_lvgl_port esp_lcd_touch_cst816s esp_lcd_ili9341 REQUIRES esp_lvgl_port esp_lcd_touch_cst816s esp_lcd_ili9341 driver vfs fatfs
) )
target_link_libraries(${COMPONENT_LIB} ${IDF_TARGET_NAME} tactility) target_link_libraries(${COMPONENT_LIB} ${IDF_TARGET_NAME} tactility)

View File

@ -0,0 +1,87 @@
#include "config.h"
#include "kernel.h"
#include "log.h"
#include <driver/spi_common.h>
#define TAG "twodotfour_bootstrap"
static bool init_i2c() {
const i2c_config_t i2c_conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_33,
.sda_pullup_en = GPIO_PULLUP_DISABLE,
.scl_io_num = GPIO_NUM_32,
.scl_pullup_en = GPIO_PULLUP_DISABLE,
.master.clk_speed = 400000
};
if (i2c_param_config(TWODOTFOUR_TOUCH_I2C_PORT, &i2c_conf) != ESP_OK) {
ESP_LOGE(TAG, "i2c config failed");
return false;
}
if (i2c_driver_install(TWODOTFOUR_TOUCH_I2C_PORT, i2c_conf.mode, 0, 0, 0) != ESP_OK) {
ESP_LOGE(TAG, "i2c driver install failed");
return false;
}
return true;
}
static bool init_spi2() {
const spi_bus_config_t bus_config = {
.sclk_io_num = TWODOTFOUR_SPI2_PIN_SCLK,
.mosi_io_num = TWODOTFOUR_SPI2_PIN_MOSI,
.miso_io_num = GPIO_NUM_NC,
.quadhd_io_num = GPIO_NUM_NC,
.quadwp_io_num = GPIO_NUM_NC,
.max_transfer_sz = TWODOTFOUR_SPI2_TRANSACTION_LIMIT
};
if (spi_bus_initialize(SPI2_HOST, &bus_config, SPI_DMA_CH_AUTO) != ESP_OK) {
TT_LOG_E(TAG, "SPI bus init failed");
return false;
}
return true;
}
static bool init_spi3() {
const spi_bus_config_t bus_config = {
.sclk_io_num = TWODOTFOUR_SPI3_PIN_SCLK,
.mosi_io_num = TWODOTFOUR_SPI3_PIN_MOSI,
.miso_io_num = TWODOTFOUR_SPI3_PIN_MISO,
.quadhd_io_num = GPIO_NUM_NC,
.quadwp_io_num = GPIO_NUM_NC,
.max_transfer_sz = TWODOTFOUR_SPI3_TRANSACTION_LIMIT
};
if (spi_bus_initialize(SPI3_HOST, &bus_config, SPI_DMA_CH_AUTO) != ESP_OK) {
TT_LOG_E(TAG, "SPI bus init failed");
return false;
}
return true;
}
bool twodotfour_bootstrap() {
TT_LOG_I(TAG, "Init I2C");
if (!init_i2c()) {
TT_LOG_E(TAG, "Init I2C failed");
return false;
}
TT_LOG_I(TAG, "Init SPI2");
if (!init_spi2()) {
TT_LOG_E(TAG, "Init SPI2 failed");
return false;
}
TT_LOG_I(TAG, "Init SPI3");
if (!init_spi3()) {
TT_LOG_E(TAG, "Init SPI3 failed");
return false;
}
return true;
}

View File

@ -0,0 +1,39 @@
#pragma once
#include "driver/spi_common.h"
#include "driver/i2c.h"
#include "driver/gpio.h"
// SPI 2 - display
#define TWODOTFOUR_SPI2_PIN_SCLK GPIO_NUM_14
#define TWODOTFOUR_SPI2_PIN_MOSI GPIO_NUM_13
#define TWODOTFOUR_SPI2_TRANSACTION_LIMIT TWODOTFOUR_LCD_DRAW_BUFFER_SIZE
// SPI 3 - sdcard
#define TWODOTFOUR_SPI3_PIN_SCLK GPIO_NUM_18
#define TWODOTFOUR_SPI3_PIN_MOSI GPIO_NUM_23
#define TWODOTFOUR_SPI3_PIN_MISO GPIO_NUM_19
#define TWODOTFOUR_SPI3_TRANSACTION_LIMIT 8192 // TODO: Determine proper limit
// Display
#define TWODOTFOUR_LCD_SPI_HOST SPI2_HOST
#define TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION 240
#define TWODOTFOUR_LCD_VERTICAL_RESOLUTION 320
#define TWODOTFOUR_LCD_BITS_PER_PIXEL 16
#define TWODOTFOUR_LCD_DRAW_BUFFER_HEIGHT (TWODOTFOUR_LCD_VERTICAL_RESOLUTION / 10)
#define TWODOTFOUR_LCD_DRAW_BUFFER_SIZE (TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION * TWODOTFOUR_LCD_DRAW_BUFFER_HEIGHT * (TWODOTFOUR_LCD_BITS_PER_PIXEL / 8))
#define TWODOTFOUR_LCD_PIN_CS GPIO_NUM_15
#define TWODOTFOUR_LCD_PIN_DC GPIO_NUM_2
#define TWODOTFOUR_LCD_PIN_BACKLIGHT GPIO_NUM_27
// Touch
#define TWODOTFOUR_TOUCH_I2C_PORT 0
// SD Card
#define TWODOTFOUR_SDCARD_SPI_HOST SPI3_HOST
#define TWODOTFOUR_SDCARD_PIN_CS GPIO_NUM_5
#define TWODOTFOUR_SDCARD_SPI_FREQUENCY 800000U
#define TWODOTFOUR_SDCARD_FORMAT_ON_MOUNT_FAILED false
#define TWODOTFOUR_SDCARD_MAX_OPEN_FILES 4
#define TWODOTFOUR_SDCARD_ALLOC_UNIT_SIZE (16 * 1024)
#define TWODOTFOUR_SDCARD_STATUS_CHECK_ENABLED false

View File

@ -1,109 +1,86 @@
#include "config.h"
#include "log.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "driver/spi_master.h"
#include "esp_err.h" #include "esp_err.h"
#include "esp_lcd_ili9341.h" #include "esp_lcd_ili9341.h"
#include "esp_lcd_panel_ops.h" #include "esp_lcd_panel_ops.h"
#include "esp_log.h"
#include "esp_lvgl_port.h" #include "esp_lvgl_port.h"
#include "hal/lv_hal_disp.h" #include "hal/lv_hal_disp.h"
#include <esp_lcd_panel_io.h> #include <esp_lcd_panel_io.h>
#define TAG "2432s024_ili9341" #define TAG "twodotfour_ili9341"
#define LCD_SPI_HOST SPI2_HOST
#define LCD_PIN_SCLK GPIO_NUM_14
#define LCD_PIN_MOSI GPIO_NUM_13
#define LCD_PIN_CS GPIO_NUM_15
#define LCD_PIN_DC GPIO_NUM_2
#define LCD_PIN_BACKLIGHT GPIO_NUM_27
#define LCD_HORIZONTAL_RESOLUTION 240
#define LCD_VERTICAL_RESOLUTION 320
#define LCD_BITS_PER_PIXEL 16
#define LCD_DRAW_BUFFER_HEIGHT (LCD_VERTICAL_RESOLUTION / 10)
lv_disp_t* yellow_board_init_display() {
ESP_LOGI(TAG, "creating display");
static void twodotfour_backlight_on() {
gpio_config_t io_conf = { gpio_config_t io_conf = {
.pin_bit_mask = BIT64(LCD_PIN_BACKLIGHT), .pin_bit_mask = BIT64(TWODOTFOUR_LCD_PIN_BACKLIGHT),
.mode = GPIO_MODE_OUTPUT, .mode = GPIO_MODE_OUTPUT,
.pull_up_en = GPIO_PULLUP_DISABLE, .pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE, .pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = GPIO_INTR_DISABLE, .intr_type = GPIO_INTR_DISABLE,
}; };
gpio_config(&io_conf); gpio_config(&io_conf);
size_t draw_buffer_size = LCD_HORIZONTAL_RESOLUTION * LCD_DRAW_BUFFER_HEIGHT * (LCD_BITS_PER_PIXEL / 8); if (gpio_set_level(TWODOTFOUR_LCD_PIN_BACKLIGHT, 1) != ESP_OK) {
const spi_bus_config_t bus_config = ILI9341_PANEL_BUS_SPI_CONFIG( TT_LOG_E(TAG, "Failed to turn backlight on");
LCD_PIN_SCLK,
LCD_PIN_MOSI,
draw_buffer_size
);
if (spi_bus_initialize(LCD_SPI_HOST, &bus_config, SPI_DMA_CH_AUTO) != ESP_OK) {
ESP_LOGD(TAG, "spi bus init failed");
return false;
} }
}
lv_disp_t* twodotfour_display_init() {
TT_LOG_I(TAG, "Display init");
const esp_lcd_panel_io_spi_config_t panel_io_config = ILI9341_PANEL_IO_SPI_CONFIG( const esp_lcd_panel_io_spi_config_t panel_io_config = ILI9341_PANEL_IO_SPI_CONFIG(
LCD_PIN_CS, TWODOTFOUR_LCD_PIN_CS,
LCD_PIN_DC, TWODOTFOUR_LCD_PIN_DC,
NULL, NULL,
NULL NULL
); );
esp_lcd_panel_io_handle_t io_handle; esp_lcd_panel_io_handle_t io_handle;
if (esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)LCD_SPI_HOST, &panel_io_config, &io_handle) != ESP_OK) { if (esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)TWODOTFOUR_LCD_SPI_HOST, &panel_io_config, &io_handle) != ESP_OK) {
ESP_LOGD(TAG, "failed to create panel"); TT_LOG_E(TAG, "Failed to create panel");
return false; return false;
} }
ESP_LOGI(TAG, "install driver");
const esp_lcd_panel_dev_config_t panel_config = { const esp_lcd_panel_dev_config_t panel_config = {
.reset_gpio_num = GPIO_NUM_NC, .reset_gpio_num = GPIO_NUM_NC,
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_BGR, .rgb_ele_order = LCD_RGB_ELEMENT_ORDER_BGR,
.bits_per_pixel = LCD_BITS_PER_PIXEL, .bits_per_pixel = TWODOTFOUR_LCD_BITS_PER_PIXEL,
}; };
esp_lcd_panel_handle_t panel_handle; esp_lcd_panel_handle_t panel_handle;
if (esp_lcd_new_panel_ili9341(io_handle, &panel_config, &panel_handle) != ESP_OK) { if (esp_lcd_new_panel_ili9341(io_handle, &panel_config, &panel_handle) != ESP_OK) {
ESP_LOGD(TAG, "failed to create ili9341"); TT_LOG_E(TAG, "Failed to create ili9341");
return false; return false;
} }
if (esp_lcd_panel_reset(panel_handle) != ESP_OK) { if (esp_lcd_panel_reset(panel_handle) != ESP_OK) {
ESP_LOGD(TAG, "failed to reset panel"); TT_LOG_E(TAG, "Failed to reset panel");
return false; return false;
} }
if (esp_lcd_panel_init(panel_handle) != ESP_OK) { if (esp_lcd_panel_init(panel_handle) != ESP_OK) {
ESP_LOGD(TAG, "failed to init panel"); TT_LOG_E(TAG, "Failed to init panel");
return false; return false;
} }
if (esp_lcd_panel_mirror(panel_handle, true, false) != ESP_OK) { if (esp_lcd_panel_mirror(panel_handle, true, false) != ESP_OK) {
ESP_LOGD(TAG, "failed to set panel to mirror"); TT_LOG_E(TAG, "Failed to set panel to mirror");
return false; return false;
} }
if (esp_lcd_panel_disp_on_off(panel_handle, true) != ESP_OK) { if (esp_lcd_panel_disp_on_off(panel_handle, true) != ESP_OK) {
ESP_LOGD(TAG, "failed to turn display on"); TT_LOG_E(TAG, "Failed to turn display on");
return false;
}
if (gpio_set_level(LCD_PIN_BACKLIGHT, 1) != ESP_OK) {
ESP_LOGD(TAG, "failed to turn backlight on");
return false; return false;
} }
const lvgl_port_display_cfg_t disp_cfg = { const lvgl_port_display_cfg_t disp_cfg = {
.io_handle = io_handle, .io_handle = io_handle,
.panel_handle = panel_handle, .panel_handle = panel_handle,
.buffer_size = LCD_HORIZONTAL_RESOLUTION * LCD_DRAW_BUFFER_HEIGHT * (LCD_BITS_PER_PIXEL / 8), .buffer_size = TWODOTFOUR_LCD_DRAW_BUFFER_SIZE,
.double_buffer = false, .double_buffer = false,
.hres = LCD_HORIZONTAL_RESOLUTION, .hres = TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION,
.vres = LCD_VERTICAL_RESOLUTION, .vres = TWODOTFOUR_LCD_VERTICAL_RESOLUTION,
.monochrome = false, .monochrome = false,
.rotation = { .rotation = {
.swap_xy = false, .swap_xy = false,
@ -115,5 +92,9 @@ lv_disp_t* yellow_board_init_display() {
} }
}; };
return lvgl_port_add_disp(&disp_cfg); lv_disp_t* display = lvgl_port_add_disp(&disp_cfg);
twodotfour_backlight_on();
return display;
} }

View File

@ -3,12 +3,12 @@
#include "ui/lvgl_sync.h" #include "ui/lvgl_sync.h"
#include <thread.h> #include <thread.h>
#define TAG "yellow_board_lvgl" #define TAG "twodotfour_lvgl"
lv_disp_t* yellow_board_init_display(); lv_disp_t* twodotfour_display_init();
bool yellow_board_init_touch(esp_lcd_panel_io_handle_t* io_handle, esp_lcd_touch_handle_t* touch_handle); bool twodotfour_touch_init(esp_lcd_panel_io_handle_t* io_handle, esp_lcd_touch_handle_t* touch_handle);
bool yellow_board_init_lvgl() { bool twodotfour_lvgl_init() {
static lv_disp_t* display = NULL; static lv_disp_t* display = NULL;
static esp_lcd_panel_io_handle_t touch_io_handle; static esp_lcd_panel_io_handle_t touch_io_handle;
static esp_lcd_touch_handle_t touch_handle; static esp_lcd_touch_handle_t touch_handle;
@ -27,15 +27,14 @@ bool yellow_board_init_lvgl() {
} }
// Add display // Add display
display = yellow_board_init_display(); display = twodotfour_display_init();
if (display == NULL) { if (display == NULL) {
TT_LOG_E(TAG, "failed to add display"); TT_LOG_E(TAG, "failed to add display");
return false; return false;
} }
// Add touch // Add touch
if (!yellow_board_init_touch(&touch_io_handle, &touch_handle)) { if (!twodotfour_touch_init(&touch_io_handle, &touch_handle)) {
return false; return false;
} }

View File

@ -0,0 +1,73 @@
#include "sdcard.h"
#include "check.h"
#include "log.h"
#include "config.h"
#include "esp_vfs_fat.h"
#include "sdmmc_cmd.h"
#define TAG "twodotfour_sdcard"
typedef struct {
const char* mount_point;
sdmmc_card_t* card;
} MountData;
static void* sdcard_mount(const char* mount_point) {
TT_LOG_I(TAG, "Mounting %s", mount_point);
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
.format_if_mount_failed = TWODOTFOUR_SDCARD_FORMAT_ON_MOUNT_FAILED,
.max_files = TWODOTFOUR_SDCARD_MAX_OPEN_FILES,
.allocation_unit_size = TWODOTFOUR_SDCARD_ALLOC_UNIT_SIZE,
.disk_status_check_enable = TWODOTFOUR_SDCARD_STATUS_CHECK_ENABLED
};
sdmmc_card_t* card;
// Init without card detect (CD) and write protect (WD)
sdspi_device_config_t slot_config = SDSPI_DEVICE_CONFIG_DEFAULT();
slot_config.gpio_cs = TWODOTFOUR_SDCARD_PIN_CS;
slot_config.host_id = TWODOTFOUR_SDCARD_SPI_HOST;
sdmmc_host_t host = SDSPI_HOST_DEFAULT();
host.max_freq_khz = TWODOTFOUR_SDCARD_SPI_FREQUENCY;
esp_err_t ret = esp_vfs_fat_sdspi_mount(mount_point, &host, &slot_config, &mount_config, &card);
if (ret != ESP_OK) {
if (ret == ESP_FAIL) {
TT_LOG_E(TAG, "Mounting failed. Ensure the card is formatted with FAT.");
} else {
TT_LOG_E(TAG, "Mounting failed (%s)", esp_err_to_name(ret));
}
return NULL;
}
MountData* data = malloc(sizeof(MountData));
*data = (MountData) {
.card = card,
.mount_point = mount_point
};
sdmmc_card_print_info(stdout, data->card);
return data;
}
static void sdcard_unmount(void* context) {
MountData* data = (MountData*)context;
TT_LOG_I(TAG, "Unmounting %s", data->mount_point);
tt_assert(data != NULL);
if (esp_vfs_fat_sdcard_unmount(data->mount_point, data->card) != ESP_OK) {
TT_LOG_E(TAG, "Unmount failed for %s", data->mount_point);
}
free(data);
}
const SdCard twodotfour_sdcard = {
.mount = &sdcard_mount,
.unmount = &sdcard_unmount,
.mount_behaviour = SDCARD_MOUNT_BEHAVIOUR_ANYTIME
};

View File

@ -1,42 +1,21 @@
#include "config.h"
#include "driver/i2c.h" #include "driver/i2c.h"
#include "log.h"
#include "esp_err.h" #include "esp_err.h"
#include "esp_lcd_touch_cst816s.h" #include "esp_lcd_touch_cst816s.h"
#include "esp_log.h"
#define TOUCH_I2C_PORT 0 #define TAG "twodotfour_cst816"
#define TAG "2432s024_cst816" bool twodotfour_touch_init(esp_lcd_panel_io_handle_t* io_handle, esp_lcd_touch_handle_t* touch_handle) {
TT_LOG_I(TAG, "Touch init");
bool yellow_board_init_touch(esp_lcd_panel_io_handle_t* io_handle, esp_lcd_touch_handle_t* touch_handle) {
ESP_LOGI(TAG, "creating touch");
const i2c_config_t i2c_conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_33,
.sda_pullup_en = GPIO_PULLUP_DISABLE,
.scl_io_num = GPIO_NUM_32,
.scl_pullup_en = GPIO_PULLUP_DISABLE,
.master.clk_speed = 400000
};
if (i2c_param_config(TOUCH_I2C_PORT, &i2c_conf) != ESP_OK) {
ESP_LOGE(TAG, "i2c config failed");
return false;
}
if (i2c_driver_install(TOUCH_I2C_PORT, i2c_conf.mode, 0, 0, 0) != ESP_OK) {
ESP_LOGE(TAG, "i2c driver install failed");
return false;
}
const esp_lcd_panel_io_i2c_config_t touch_io_config = ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG(); const esp_lcd_panel_io_i2c_config_t touch_io_config = ESP_LCD_TOUCH_IO_I2C_CST816S_CONFIG();
if (esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)TOUCH_I2C_PORT, &touch_io_config, io_handle) != ESP_OK) { if (esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)TWODOTFOUR_TOUCH_I2C_PORT, &touch_io_config, io_handle) != ESP_OK) {
ESP_LOGE(TAG, "touch I2C IO init failed"); TT_LOG_E(TAG, "Touch I2C IO init failed");
return false; return false;
} }
ESP_LOGI(TAG, "create_touch");
esp_lcd_touch_config_t config = { esp_lcd_touch_config_t config = {
.x_max = 240, .x_max = 240,
.y_max = 320, .y_max = 320,
@ -57,7 +36,7 @@ bool yellow_board_init_touch(esp_lcd_panel_io_handle_t* io_handle, esp_lcd_touch
}; };
if (esp_lcd_touch_new_i2c_cst816s(*io_handle, &config, touch_handle) != ESP_OK) { if (esp_lcd_touch_new_i2c_cst816s(*io_handle, &config, touch_handle) != ESP_OK) {
ESP_LOGE(TAG, "esp_lcd_touch_new_i2c_cst816s failed"); TT_LOG_E(TAG, "Driver init failed");
return false; return false;
} }

View File

@ -1,8 +1,12 @@
#include "yellow_board.h" #include "yellow_board.h"
bool yellow_board_init_lvgl(); bool twodotfour_lvgl_init();
bool twodotfour_bootstrap();
extern const SdCard twodotfour_sdcard;
const HardwareConfig yellow_board_24inch_cap = { const HardwareConfig yellow_board_24inch_cap = {
.bootstrap = NULL, .bootstrap = &twodotfour_bootstrap,
.init_lvgl = &yellow_board_init_lvgl .init_lvgl = &twodotfour_lvgl_init,
.sdcard = &twodotfour_sdcard
}; };

View File

@ -54,7 +54,7 @@ void gui_free(Gui* instance) {
void gui_lock() { void gui_lock() {
tt_assert(gui); tt_assert(gui);
tt_assert(gui->mutex); tt_assert(gui->mutex);
tt_check(tt_mutex_acquire(gui->mutex, 1000 / portTICK_PERIOD_MS) == TtStatusOk); tt_check(tt_mutex_acquire(gui->mutex, configTICK_RATE_HZ) == TtStatusOk);
} }
void gui_unlock() { void gui_unlock() {
@ -84,7 +84,7 @@ void gui_hide_app() {
// We must lock the LVGL port, because the viewport hide callbacks // We must lock the LVGL port, because the viewport hide callbacks
// might call LVGL APIs (e.g. to remove the keyboard from the screen root) // might call LVGL APIs (e.g. to remove the keyboard from the screen root)
tt_check(tt_lvgl_lock(1000)); tt_check(tt_lvgl_lock(configTICK_RATE_HZ));
view_port_hide(view_port); view_port_hide(view_port);
tt_lvgl_unlock(); tt_lvgl_unlock();

View File

@ -23,15 +23,12 @@ void gui_keyboard_show(lv_obj_t* textarea) {
gui_lock(); gui_lock();
if (gui->keyboard) { if (gui->keyboard) {
gui_lock();
lv_obj_clear_flag(gui->keyboard, LV_OBJ_FLAG_HIDDEN); lv_obj_clear_flag(gui->keyboard, LV_OBJ_FLAG_HIDDEN);
lv_keyboard_set_textarea(gui->keyboard, textarea); lv_keyboard_set_textarea(gui->keyboard, textarea);
if (gui->toolbar) { if (gui->toolbar) {
lv_obj_add_flag(gui->toolbar, LV_OBJ_FLAG_HIDDEN); lv_obj_add_flag(gui->toolbar, LV_OBJ_FLAG_HIDDEN);
} }
} }
gui_unlock(); gui_unlock();

View File

@ -15,7 +15,7 @@
#include "semphr.h" #include "semphr.h"
#endif #endif
#define TAG "Loader" #define TAG "loader"
// Forward declarations // Forward declarations
static int32_t loader_main(void* p); static int32_t loader_main(void* p);