Move fonts / assets definition from main/boards to CMakeLists.txt (#1174)

* update surfer-c3-1.14tft font size

* Move fonts / assets definition from main/boards to CMakeLists.txt

* fix c3 compiling errors

---------

Co-authored-by: Xiaoxia <terrence.huang@tenclass.com>
This commit is contained in:
Xiaoxia
2025-09-08 17:30:18 +08:00
committed by GitHub
parent 897239e997
commit d04b08133f
111 changed files with 1193 additions and 1673 deletions

View File

@@ -1,25 +1,21 @@
#include "custom_lcd_display.h"
#include "config.h"
#include "custom_lcd_display.h"
#include "lcd_display.h"
#include "assets/lang_config.h"
#include "settings.h"
#include "board.h"
#include <vector>
#include <cstring>
#include <esp_lcd_panel_io.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <freertos/semphr.h>
#include <esp_log.h>
#include <esp_err.h>
#include <esp_lvgl_port.h>
#include "assets/lang_config.h"
#include <cstring>
#include "settings.h"
#include "esp_lcd_panel_io.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "config.h"
#include "board.h"
#define TAG "CustomLcdDisplay"
@@ -45,7 +41,6 @@
#define LIGHT_BORDER_COLOR lv_color_hex(0xE0E0E0) // Light gray border
#define LIGHT_LOW_BATTERY_COLOR lv_color_black() // Black for light mode
// Define dark theme colors
static const ThemeColors DARK_THEME = {
.background = DARK_BACKGROUND_COLOR,
@@ -80,8 +75,6 @@ static uint16_t *trans_act;
static uint16_t *trans_buf_1;
static uint16_t *trans_buf_2;
bool CustomLcdDisplay::lvgl_port_flush_io_ready_callback(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
{
BaseType_t taskAwake = pdFALSE;
@@ -99,7 +92,6 @@ void CustomLcdDisplay::lvgl_port_flush_callback(lv_display_t *drv, const lv_area
esp_lcd_panel_handle_t panel_handle = (esp_lcd_panel_handle_t)lv_display_get_driver_data(drv);
assert(panel_handle != NULL);
size_t len = lv_area_get_size(area);
lv_draw_sw_rgb565_swap(color_map, len);
@@ -249,11 +241,9 @@ void CustomLcdDisplay::lvgl_port_flush_callback(lv_display_t *drv, const lv_area
lv_disp_flush_ready(drv);
}
CustomLcdDisplay::CustomLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y, bool swap_xy,
DisplayStyle style)
: LcdDisplay(panel_io, panel, width, height, style) {
int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y, bool swap_xy)
: LcdDisplay(panel_io, panel, width, height) {
// width_ = width;
// height_ = height;

View File

@@ -8,8 +8,7 @@ class CustomLcdDisplay : public LcdDisplay {
public:
CustomLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
int width, int height, int offset_x, int offset_y,
bool mirror_x, bool mirror_y, bool swap_xy,
DisplayStyle style);
bool mirror_x, bool mirror_y, bool swap_xy);
private:
static bool lvgl_port_flush_io_ready_callback(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx);
static void lvgl_port_flush_callback(lv_display_t *drv, const lv_area_t *area, uint8_t *color_map);

View File

@@ -21,7 +21,6 @@
#include "axp2101.h"
#include "power_save_timer.h"
#include "esp_lcd_axs15231b.h"
#include "custom_lcd_display.h"
@@ -34,11 +33,6 @@
#define TAG "waveshare_lcd_3_5b"
LV_FONT_DECLARE(font_puhui_basic_16_4);
LV_FONT_DECLARE(font_awesome_16_4);
static const axs15231b_lcd_init_cmd_t lcd_init_cmds[] = {
{0xBB, (uint8_t[]){0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5A, 0xA5}, 8, 0},
{0xA0, (uint8_t[]){0xC0, 0x10, 0x00, 0x02, 0x00, 0x00, 0x04, 0x3F, 0x20, 0x05, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00}, 17, 0},
@@ -75,8 +69,6 @@ static const axs15231b_lcd_init_cmd_t lcd_init_cmds[] = {
{0x2a, (uint8_t[]){0x00, 0x00, 0x01, 0x3f}, 4, 0},
{0x2b, (uint8_t[]){0x00, 0x00, 0x01, 0xdf}, 4, 0}};
class Pmic : public Axp2101 {
public:
Pmic(i2c_master_bus_handle_t i2c_bus, uint8_t addr) : Axp2101(i2c_bus, addr) {
@@ -260,8 +252,7 @@ private:
.vendor_config = (void *)&vendor_config,
};
esp_lcd_new_panel_axs15231b(panel_io, &panel_config, &panel);
esp_lcd_panel_reset(panel);
esp_lcd_panel_init(panel);
@@ -271,8 +262,7 @@ private:
esp_lcd_panel_mirror(panel, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y);
display_ = new CustomLcdDisplay(panel_io, panel,
DISPLAY_WIDTH, DISPLAY_HEIGHT, DISPLAY_OFFSET_X, DISPLAY_OFFSET_Y, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y, DISPLAY_SWAP_XY,
{&font_puhui_basic_16_4, &font_awesome_16_4});
DISPLAY_WIDTH, DISPLAY_HEIGHT, DISPLAY_OFFSET_X, DISPLAY_OFFSET_Y, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y, DISPLAY_SWAP_XY);
}
void InitializeButtons() {
@@ -285,7 +275,6 @@ private:
});
}
void InitializeTouch()
{
esp_lcd_touch_handle_t tp;
@@ -318,7 +307,6 @@ private:
ESP_LOGI(TAG, "Touch panel initialized successfully");
}
public:
CustomBoard() :
boot_button_(BOOT_BUTTON_GPIO) {
@@ -340,11 +328,6 @@ public:
GetBacklight()->RestoreBrightness();
}
virtual Assets* GetAssets() override {
static Assets assets(ASSETS_XIAOZHI_PUHUI_COMMON_16_4_EMOJI_32);
return &assets;
}
virtual AudioCodec* GetAudioCodec() override {
static Es8311AudioCodec audio_codec(i2c_bus_, I2C_NUM_0, AUDIO_INPUT_SAMPLE_RATE, AUDIO_OUTPUT_SAMPLE_RATE,
AUDIO_I2S_GPIO_MCLK, AUDIO_I2S_GPIO_BCLK, AUDIO_I2S_GPIO_WS, AUDIO_I2S_GPIO_DOUT, AUDIO_I2S_GPIO_DIN,
@@ -363,6 +346,7 @@ public:
virtual Camera* GetCamera() override {
return camera_;
}
#if PMIC_ENABLE
virtual bool GetBatteryLevel(int &level, bool& charging, bool& discharging) override {
static bool last_discharging = false;