Add HW-269 white LED test with SoftSPI touch and LVGL.

PWM on GPIO22 for on/off and brightness; UI layout keeps slider and power button separate.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-23 10:33:41 +08:00
commit ad4e0061f2
23 changed files with 1837 additions and 0 deletions

9
include/lamp.h Normal file
View File

@@ -0,0 +1,9 @@
#pragma once
#include <stdint.h>
void lamp_init();
void lamp_set_on(bool on);
bool lamp_is_on();
void lamp_set_brightness(uint8_t percent); // 0..100
uint8_t lamp_brightness();

1127
include/lv_conf.h Normal file

File diff suppressed because it is too large Load Diff

18
include/pins.h Normal file
View File

@@ -0,0 +1,18 @@
#pragma once
// CYD ESP32-2432S028R — 触控/屏脚与 tftest 一致
#define TFT_BL_PIN 21
#define CYD_TOUCH_IRQ 36
#define CYD_TOUCH_MOSI 32
#define CYD_TOUCH_MISO 39
#define CYD_TOUCH_CLK 25
#define CYD_TOUCH_CS 33
#define HW269_PIN 22
#define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 320
#define UI_HOR_RES 320
#define UI_VER_RES 240

12
include/touch.h Normal file
View File

@@ -0,0 +1,12 @@
#pragma once
#include <lvgl.h>
#include <stdint.h>
void touch_init();
void touch_read_cb(lv_indev_t *indev, lv_indev_data_t *data);
// 调试:最近一次触点(物理 / LVGL 旋转后逻辑)
extern int16_t g_dbg_phys_x, g_dbg_phys_y;
extern int16_t g_dbg_logic_x, g_dbg_logic_y;
extern bool g_dbg_touch_down;

4
include/ui.h Normal file
View File

@@ -0,0 +1,4 @@
#pragma once
void ui_create();
void ui_refresh_lamp();