Snapshot Beep + WAV UI before Pomodoro rewrite.
Keep LEDC tones, TF WAV playback, and compact list layout as a tagged baseline. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,20 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void audio_init();
|
||||
|
||||
void audio_set_enabled(bool on);
|
||||
bool audio_is_enabled();
|
||||
|
||||
// 音量 0–100,默认 20
|
||||
void audio_set_volume(uint8_t percent);
|
||||
uint8_t audio_get_volume();
|
||||
|
||||
void audio_play_music();
|
||||
// 内置提示音
|
||||
uint8_t sound_count();
|
||||
const char *sound_name(uint8_t idx);
|
||||
int8_t sound_selected();
|
||||
void sound_set_selected(int8_t idx);
|
||||
void audio_play_sound(uint8_t idx);
|
||||
|
||||
// WAV(TF)
|
||||
void audio_play_wav_index(uint8_t idx);
|
||||
void audio_play_selected(); // 按当前 tab 语义由 UI 决定;保留播 beep 选中
|
||||
|
||||
void audio_stop();
|
||||
bool audio_is_playing();
|
||||
|
||||
void audio_tick();
|
||||
|
||||
const char *audio_last_status();
|
||||
|
||||
7
include/sd_put.h
Normal file
7
include/sd_put.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// 串口协议: "#PUT <path> <bytes>\n" -> READY -> raw -> DONE/FAIL
|
||||
// 在 loop 里调用;返回 true 表示刚处理完一次传输
|
||||
bool sd_put_poll();
|
||||
@@ -6,4 +6,8 @@
|
||||
void ui_create();
|
||||
void ui_update(const SdCardInfo &info);
|
||||
void ui_refresh_audio_buttons();
|
||||
void ui_refresh_lists();
|
||||
void ui_set_touch_debug(int16_t lx, int16_t ly, bool down);
|
||||
|
||||
// 0=Beep 1=WAV
|
||||
uint8_t ui_active_tab();
|
||||
|
||||
23
include/wav_list.h
Normal file
23
include/wav_list.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static constexpr size_t WAV_MAX = 24;
|
||||
static constexpr size_t WAV_PATH_MAX = 64;
|
||||
static constexpr size_t WAV_NAME_MAX = 28;
|
||||
|
||||
struct WavTrack {
|
||||
char path[WAV_PATH_MAX];
|
||||
char name[WAV_NAME_MAX];
|
||||
uint32_t bytes;
|
||||
};
|
||||
|
||||
uint8_t wav_list_count();
|
||||
int8_t wav_list_selected();
|
||||
void wav_list_set_selected(int8_t idx);
|
||||
const WavTrack *wav_list_get(uint8_t idx);
|
||||
const char *wav_list_current_path();
|
||||
|
||||
bool wav_list_scan();
|
||||
12
include/wav_player.h
Normal file
12
include/wav_player.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void wav_player_init();
|
||||
void wav_player_stop();
|
||||
bool wav_player_is_playing();
|
||||
bool wav_player_play_path(const char *path);
|
||||
void wav_player_set_volume(uint8_t percent); // 0-100, maps to SetGain
|
||||
void wav_player_tick(); // no-op if task handles; kept for API
|
||||
const char *wav_player_status();
|
||||
Reference in New Issue
Block a user