Add HW-069 v1.1 4-digit TM1637 test with SoftSPI touch and LVGL.

CLK on GPIO22, DIO on GPIO27; value/brightness/colon controls and flashable firmware/cyd package.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-23 14:08:51 +08:00
commit 9576c5f7d2
23 changed files with 2091 additions and 0 deletions

21
include/digit.h Normal file
View File

@@ -0,0 +1,21 @@
#pragma once
#include <stdint.h>
void digit_init();
void digit_set_on(bool on);
bool digit_is_on();
/** 显示数值 0..9999(超出钳位) */
void digit_set_value(int value);
int digit_get_value();
/** 亮度 0..100,映射到 TM1637 8 档 */
void digit_set_brightness(uint8_t percent);
uint8_t digit_brightness();
void digit_set_colon(bool on);
bool digit_colon();
void digit_clear();

1127
include/lv_conf.h Normal file

File diff suppressed because it is too large Load Diff

20
include/pins.h Normal file
View File

@@ -0,0 +1,20 @@
#pragma once
// CYD ESP32-2432S028R — 触控/屏脚与 tftest 一致
// HW-069 v1.1 四位数显(TM1637):CLK=GPIO22,DIO=GPIO27
#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 HW069_CLK_PIN 22
#define HW069_DIO_PIN 27
#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_digit();