魔盒最新版本,更新了充电检测,鸟叫,dp4对声音的控制,声音模块由于硬件问题暂未实测

This commit is contained in:
2026-09-09 15:32:50 +08:00
parent 3ab37b7845
commit b576f31113
22 changed files with 871 additions and 528 deletions
+10 -9
View File
@@ -26,7 +26,7 @@
#define BOARD_LED_ENABLE 1 /**< 1=红绿 LED */
#define BOARD_KEY_ENABLE 1 /**< 1=按键 PB1 */
#define BOARD_CHG_ENABLE 1 /**< 1=充电检测 PG8 + VPWR */
#define BOARD_CHG_ENABLE 1 /**< 1=TP4056: PG8 CHRG + PC5 STDBY */
#define BOARD_MOTOR_ENABLE 1 /**< 1=双电机 U13 + U18 */
#define BOARD_SHAKE_ENABLE 1 /**< 1=震动输入 PA3 */
@@ -39,14 +39,16 @@
#define BOARD_RIGHT_BACKWARD_PIN IO_PORTC_03 /**< U18-INA,右轮后退 */
#define BOARD_RIGHT_FORWARD_PIN IO_PORTC_04 /**< U18-INB,右轮前进 */
#define BOARD_SHAKE_PIN IO_PORTA_03 /**< 震动开机,常闭开关断开时高脉冲有效 */
#define BOARD_LED_RED_PIN IO_PORTA_08 /**< 红灯 LED_PWR,低电平亮 */
#define BOARD_LED_GREEN_PIN IO_PORTA_07 /**< 绿灯 LED_CHG,低电平亮 */
#define BOARD_LED_RED_PIN IO_PORTA_07 /**< 红灯 LED_PWR,低电平亮 */
#define BOARD_LED_GREEN_PIN IO_PORTA_08 /**< 绿灯 LED_CHG,低电平亮 */
#define BOARD_KEY_PIN IO_PORTB_01 /**< 按键,低电平按下 */
#define BOARD_CHG_PIN IO_PORTG_08 /**< ME4054 CHG,外部 2.2k 上拉 */
#define BOARD_CHG_PIN IO_PORTG_08 /**< TP4056 CHRG, active low, internal pull-up */
#define BOARD_STDBY_PIN IO_PORTC_05 /**< TP4056 STDBY, active low, internal pull-up */
#define BOARD_LED_ON_LEVEL 0 /**< LED 点亮电平:0=低亮 */
#define BOARD_KEY_ACTIVE_LEVEL 0 /**< 按键有效电平:0=按下为低 */
#define BOARD_CHG_CHARGING_LEVEL 0 /**< CHG 充电中为低 */
#define BOARD_STDBY_FULL_LEVEL 0 /**< STDBY 充满时为低 */
#define BOARD_SHAKE_ACTIVE_LEVEL 1 /**< 常闭震动开关:断开时高脉冲有效 */
@@ -62,9 +64,9 @@
#define BOARD_VBAT_LOW_HYST_MV 50 /**< 低电恢复回差 */
#define BOARD_VBAT_SHUTDOWN_MV 3250 /**< 约 5%,仅开机拦截用:关机状态下 app_battery 尚未运行,只能摸裸电压 */
#define BOARD_BATTERY_SHUTDOWN_PCT 5 /**< 运行中显示电量 <= 此值才自动关机,跟 APP 看到的百分比对齐 */
#define BOARD_VPWR_ONLINE_MV 4000 /**< VPWR 判定 USB 插入 */
#define BOARD_VPWR_OFF_MV 1500 /**< 低于此值认定已拔出 */
#define BOARD_CHG_FULL_MS 1000 /**< CHG 已高且 VPWR 在,满 1s 认充满 */
#define BOARD_VPWR_ONLINE_MV 4000
#define BOARD_VPWR_OFF_MV 1500
#define BOARD_CHG_FULL_MS 1000 /**< STDBY low confirmation time */
/*============================================================================*/
/* 按键 / 灯效 */
@@ -124,8 +126,7 @@
#define BOARD_SHAKE_TRIGGER_WINDOW_MS 250u /**< 保留窗口参数,便于恢复多脉冲策略 */
#define BOARD_SHAKE_POLL_MS 10u /**< 与业务调度器共用的采样节拍 */
/* PG8/CHG_ON is the only fitted USB-related signal that changes while the
* product is in softoff; VPWR is disconnected on boards with R18 not fitted. */
/* PG8/CHRG is used to detect charge insertion while in softoff. */
#define BOARD_CHG_WAKEUP_INDEX 3u
#endif /* __BOARD_PIN_H__ */