Files
Smart-granary-code/components/lvgl_st7789_use/include/lvgl_st7789_use.h
Wang Beihong ffdb7065e3 功能:集成SU-03T语音模块,完善UI代码文档
- 在CMakeLists.txt中添加SU-03T语音模块依赖。
- 在main.cpp中实现SU-03T接收回调函数,处理接收消息。
- 完善各UI源文件文档,包括动作、屏幕和字体,明确模块作用与数据流向。
- 更新主应用逻辑,初始化并启动SU-03T接收器。
- 修改过程中确保兼容性,保留原有接口。
2026-04-22 01:06:10 +08:00

90 lines
3.0 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* 文件: components/lvgl_st7789_use/include/lvgl_st7789_use.h
* 角色: ST7789 屏幕与 LVGL 适配
* 说明:
* - 本文件用于实现当前模块的核心功能或接口定义。
* - 修改前请先确认该模块与其它任务/外设之间的数据流关系。
* - 涉及协议与硬件时,优先保持现有接口兼容,避免联调回归。
*/
// SPDX-License-Identifier: MIT
#pragma once
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
/* LCD pins */
#ifndef EXAMPLE_LCD_GPIO_SCLK
#define EXAMPLE_LCD_GPIO_SCLK CONFIG_LVGL_ST7789_GPIO_SCLK
#endif
#ifndef EXAMPLE_LCD_GPIO_MOSI
#define EXAMPLE_LCD_GPIO_MOSI CONFIG_LVGL_ST7789_GPIO_MOSI
#endif
#ifndef EXAMPLE_LCD_GPIO_RST
#define EXAMPLE_LCD_GPIO_RST CONFIG_LVGL_ST7789_GPIO_RST
#endif
#ifndef EXAMPLE_LCD_GPIO_DC
#define EXAMPLE_LCD_GPIO_DC CONFIG_LVGL_ST7789_GPIO_DC
#endif
#ifndef EXAMPLE_LCD_GPIO_CS
#define EXAMPLE_LCD_GPIO_CS CONFIG_LVGL_ST7789_GPIO_CS
#endif
#ifndef EXAMPLE_LCD_GPIO_BL
#define EXAMPLE_LCD_GPIO_BL CONFIG_LVGL_ST7789_GPIO_BL
#endif
/* LCD size (ST7789 240x240) */
// 可通过 menuconfig 配置
#ifndef EXAMPLE_LCD_H_RES
#define EXAMPLE_LCD_H_RES CONFIG_LVGL_ST7789_LCD_H_RES
#endif
#ifndef EXAMPLE_LCD_V_RES
#define EXAMPLE_LCD_V_RES CONFIG_LVGL_ST7789_LCD_V_RES
#endif
/* 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 (0)
#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)
esp_err_t start_lvgl_demo(void);
esp_err_t lvgl_st7789_set_center_text(const char *text);
#ifdef __cplusplus
}
#endif