mirror of
https://git.beihong.wang/wangbeihong/iot-bedroom-environment-controller.git
synced 2026-04-24 05:23:05 +08:00
refactor(display): migrate from ST7735S to ST7789 driver
- Rename component directory from lvgl_st7735s_use to lvgl_st7789_use - Update CMakeLists.txt to register new source files - Add comprehensive README documentation for ST7789 configuration - Add time_alarm module with SNTP synchronization and alarm management - Add sensors header for sensor abstraction layer
This commit is contained in:
61
components/lvgl_st7789_use/include/lvgl_st7789_use.h
Normal file
61
components/lvgl_st7789_use/include/lvgl_st7789_use.h
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* LCD size (ST7789 240x240) */
|
||||
#define EXAMPLE_LCD_H_RES (160)
|
||||
#define EXAMPLE_LCD_V_RES (80)
|
||||
|
||||
/* LCD SPI总线配置 */
|
||||
#define EXAMPLE_LCD_SPI_NUM (SPI2_HOST) // 使用SPI2主机接口进行通信
|
||||
|
||||
/* LCD显示参数配置 */
|
||||
#define EXAMPLE_LCD_PIXEL_CLK_HZ (20 * 1000 * 1000) // ST7789常用20MHz,兼顾稳定性与刷新速度
|
||||
|
||||
/* LCD命令和参数配置 */
|
||||
#define EXAMPLE_LCD_CMD_BITS (8) // 命令位数为8位,用于发送LCD控制命令
|
||||
#define EXAMPLE_LCD_PARAM_BITS (8) // 参数位数为8位,用于发送命令参数
|
||||
|
||||
/* LCD颜色和缓冲区配置 */
|
||||
#define EXAMPLE_LCD_BITS_PER_PIXEL (16) // 每个像素使用16位颜色(RGB565格式)
|
||||
#define EXAMPLE_LCD_DRAW_BUFF_DOUBLE (1) // 启用双缓冲模式,提高显示流畅度
|
||||
#define EXAMPLE_LCD_DRAW_BUFF_HEIGHT (50) // 绘图缓冲区高度为50行,影响刷新性能
|
||||
|
||||
/* ST7789颜色配置(出现偏色时优先调整这三项) */
|
||||
#define EXAMPLE_LCD_COLOR_ORDER_BGR (0) // 0: RGB, 1: BGR
|
||||
#define EXAMPLE_LCD_INVERT_COLOR (1) // 0: 正常色, 1: 反色
|
||||
#define EXAMPLE_LCD_SWAP_BYTES (1) // 0: 不交换RGB565高低字节, 1: 交换
|
||||
|
||||
/* LCD背光配置 */
|
||||
#define EXAMPLE_LCD_BL_ON_LEVEL (1) // 背光开启电平为高电平(1)
|
||||
|
||||
/* LCD方向/偏移配置 */
|
||||
#define EXAMPLE_LCD_GAP_X (0)
|
||||
#define EXAMPLE_LCD_GAP_Y (26)
|
||||
#define EXAMPLE_LCD_ROT_SWAP_XY (1)
|
||||
#define EXAMPLE_LCD_ROT_MIRROR_X (1)
|
||||
#define EXAMPLE_LCD_ROT_MIRROR_Y (0)
|
||||
|
||||
/* 调试项:上电后是否先显示三色测试图 */
|
||||
#define EXAMPLE_LCD_ENABLE_COLOR_TEST (0)
|
||||
|
||||
/* LCD pins */
|
||||
#define EXAMPLE_LCD_GPIO_SCLK (GPIO_NUM_2)
|
||||
#define EXAMPLE_LCD_GPIO_MOSI (GPIO_NUM_3)
|
||||
#define EXAMPLE_LCD_GPIO_RST (GPIO_NUM_9)
|
||||
#define EXAMPLE_LCD_GPIO_DC (GPIO_NUM_8)
|
||||
#define EXAMPLE_LCD_GPIO_CS (GPIO_NUM_7)
|
||||
#define EXAMPLE_LCD_GPIO_BL (GPIO_NUM_6)
|
||||
|
||||
esp_err_t start_lvgl_demo(void);
|
||||
esp_err_t lvgl_st7789_set_center_text(const char *text);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user