Add touch buttons for speaker toggle and music playback.
Enable SoftSPI touch, replace auto beeps with Speaker ON/OFF and Play Music controls, and document usage. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,8 +3,17 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
void audio_init();
|
||||
// 短测:三声蜂鸣(开机 / 周期测试)
|
||||
void audio_play_beep_sequence();
|
||||
// 简短旋律(约 1.5s)
|
||||
void audio_play_melody();
|
||||
|
||||
// 扬声器总开关(关则静音并停止播放)
|
||||
void audio_set_enabled(bool on);
|
||||
bool audio_is_enabled();
|
||||
|
||||
// 开始/停止内置音乐(非阻塞,在 audio_tick 推进)
|
||||
void audio_play_music();
|
||||
void audio_stop();
|
||||
bool audio_is_playing();
|
||||
|
||||
// 主循环调用
|
||||
void audio_tick();
|
||||
|
||||
const char *audio_last_status();
|
||||
|
||||
@@ -14,5 +14,17 @@
|
||||
// 板载 SC8002B 功放 → P4 喇叭座(DAC2)
|
||||
#define SPEAKER_PIN 26
|
||||
|
||||
// 触摸 XPT2046(SoftSPI,避开 VSPI)
|
||||
#define TOUCH_IRQ 36
|
||||
#define TOUCH_MOSI 32
|
||||
#define TOUCH_MISO 39
|
||||
#define TOUCH_CLK 25
|
||||
#define TOUCH_CS 33
|
||||
|
||||
// 物理竖屏分辨率(TFT 驱动)
|
||||
#define SCREEN_WIDTH 240
|
||||
#define SCREEN_HEIGHT 320
|
||||
|
||||
// 横屏逻辑分辨率(LV_DISPLAY_ROTATION_270)
|
||||
#define UI_HOR_RES 320
|
||||
#define UI_VER_RES 240
|
||||
|
||||
6
include/touch.h
Normal file
6
include/touch.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
void touch_init();
|
||||
void touch_read_cb(lv_indev_t *indev, lv_indev_data_t *data);
|
||||
@@ -4,4 +4,4 @@
|
||||
|
||||
void ui_create();
|
||||
void ui_update(const SdCardInfo &info);
|
||||
void ui_set_audio_status(const char *text);
|
||||
void ui_refresh_audio_buttons();
|
||||
|
||||
Reference in New Issue
Block a user