/** ****************************************************************************** * @file app_state.h * @brief 应用层共享状态声明 * 所有变量在 main.c 中定义, 各模块通过此头文件访问. ****************************************************************************** */ #ifndef __APP_STATE_H #define __APP_STATE_H #ifdef __cplusplus extern "C" { #endif #include /* ========== 主从同步变量 (来自主板) ========== */ extern volatile uint8_t g_inputSource; /* 0=未知, 1=BT, 2=AUX */ extern volatile uint8_t g_btConnState; /* 蓝牙连接状态 */ extern volatile uint8_t g_audioPlaying; /* 音频播放状态 (0=停, 1=播放) */ extern volatile uint8_t g_batteryPct; /* 电量 0-100 */ extern volatile uint8_t g_chgFull; /* 充满标志 */ extern volatile uint8_t g_chgIng; /* 充电中: 0/1/0xFE */ extern volatile uint8_t g_dacMute; /* DAC静音状态 */ /* ========== 音量等级 (本地操作值) ========== */ extern volatile int16_t g_volLRLevel; /* 主音量 0-100 */ extern volatile int16_t g_volBassLevel; /* 低音音量 0-100 */ /* ========== 异步发送标志 (由中断置位, 主循环处理) ========== */ extern volatile uint8_t g_flagSendVolLR; extern volatile uint8_t g_flagSendVolBass; extern volatile uint8_t g_flagSendDacUnmute; /* ========== 面板本地状态 ========== */ extern volatile uint8_t g_dataReceived; /* 是否收到过主板数据 */ extern volatile uint8_t g_mutedByBtn; /* 是否被SW2_KEY静音 */ /* 各状态接收标志 (用于开机全亮无缝切换) */ extern volatile uint8_t g_volLRReceived; extern volatile uint8_t g_volBassReceived; extern volatile uint8_t g_batteryReceived; extern volatile uint8_t g_sourceReceived; /* ========== 系统毫秒计时 ========== */ extern volatile uint32_t g_sysMs; /* 系统毫秒计数器 */ /* ========== 空闲查询计时 ========== */ extern volatile uint16_t g_idleTimer; /* 空闲计时器(ms) */ extern volatile uint8_t g_userActive; /* 用户是否在操作 */ #ifdef __cplusplus } #endif #endif /* __APP_STATE_H */