完成,等待客户测试反馈
This commit is contained in:
parent
b499020541
commit
e29e8de8fc
@ -99,8 +99,9 @@ AC695x SDK 音频板定制固件,主要实现:
|
||||
|
||||
### 4.2 按键 K5 / K6(音量键)
|
||||
|
||||
- K5(VOL+):`app_task_put_key_msg(KEY_VOL_UP)`,KUP_LED 常亮 3s 后慢闪
|
||||
- K6(VOL-):音量 > 2 时 `KEY_VOL_DOWN`,KDOWN_LED 常亮 3s 后慢闪
|
||||
- K5(VOL+):`app_task_put_key_msg(KEY_VOL_UP)`
|
||||
- K6(VOL-):音量 > 2 时 `KEY_VOL_DOWN`
|
||||
- 灯态:播放时与当前 KEY_LED 一起常亮;待机时与其它按键灯同步慢闪(无按后单独亮 3s)
|
||||
|
||||
### 4.3 LED 行为对照(需求 vs 当前)
|
||||
|
||||
@ -110,7 +111,7 @@ AC695x SDK 音频板定制固件,主要实现:
|
||||
| SYS_LED | 待机慢闪 / 播放常亮 / 报错快闪 | ✅ 已实现 |
|
||||
| KEY_LED(按键灯) | 待机:4 路同步慢闪;播放:当前路常亮,其它灭 | ✅ 已实现并通过 |
|
||||
| LED_BAR(灯条) | 播放:当前通道常亮;待机:全灭 | ✅ 已实现并通过 |
|
||||
| KUP / KDOWN | 播放时常亮 | 🛠️ 播放时仍慢闪,待修改 |
|
||||
| KUP / KDOWN | 播放常亮;待机与 KEY_LED 同步慢闪 | ✅ 已实现 |
|
||||
|
||||
|
||||
### 4.4 U 盘升级
|
||||
|
||||
@ -298,7 +298,7 @@ u16 dev_update_check(char *logo)
|
||||
}
|
||||
|
||||
/* 升级开始:SYS_LED 快闪 + 播 TONE_SUP(四通道全开) */
|
||||
kt_update_start_remind();
|
||||
//kt_update_start_remind();
|
||||
|
||||
#if(USER_UART_UPDATE_ENABLE) && (UART_UPDATE_ROLE == UART_UPDATE_MASTER)
|
||||
uart_update_send_update_ready(update_path);
|
||||
|
||||
@ -1,157 +1,157 @@
|
||||
#include "key_driver.h"
|
||||
#include "adkey.h"
|
||||
#include "gpio.h"
|
||||
#include "system/event.h"
|
||||
#include "app_config.h"
|
||||
|
||||
|
||||
#if TCFG_ADKEY_ENABLE
|
||||
|
||||
static const struct adkey_platform_data *__this = NULL;
|
||||
|
||||
u8 ad_get_key_value(void);
|
||||
//按键驱动扫描参数列表
|
||||
struct key_driver_para adkey_scan_para = {
|
||||
.scan_time = 10, //按键扫描频率, 单位: ms
|
||||
.last_key = NO_KEY, //上一次get_value按键值, 初始化为NO_KEY;
|
||||
.filter_time = 2, //按键消抖延时;
|
||||
.long_time = 75, //按键判定长按数量
|
||||
.hold_time = (75 + 15), //按键判定HOLD数量
|
||||
.click_delay_time = 20, //按键被抬起后等待连击延时数量
|
||||
.key_type = KEY_DRIVER_TYPE_AD,
|
||||
.get_value = ad_get_key_value,
|
||||
};
|
||||
u8 ad_get_key_value(void)
|
||||
{
|
||||
u8 i;
|
||||
u16 ad_data;
|
||||
|
||||
if (!__this->enable) {
|
||||
return NO_KEY;
|
||||
}
|
||||
|
||||
/* ad_data = adc_get_voltage(__this->ad_channel); */
|
||||
ad_data = adc_get_value(__this->ad_channel);
|
||||
/* printf("ad_value = %d \n", ad_data); */
|
||||
for (i = 0; i < ADKEY_MAX_NUM; i++) {
|
||||
if ((ad_data <= __this->ad_value[i]) && (__this->ad_value[i] < 0x3ffL)) {
|
||||
return __this->key_value[i];
|
||||
}
|
||||
}
|
||||
return NO_KEY;
|
||||
}
|
||||
|
||||
int adkey_init(const struct adkey_platform_data *adkey_data)
|
||||
{
|
||||
__this = adkey_data;
|
||||
if (!__this) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!__this->enable) {
|
||||
return KEY_NOT_SUPPORT;
|
||||
}
|
||||
adc_add_sample_ch(__this->ad_channel); //注意:初始化AD_KEY之前,先初始化ADC
|
||||
#if (TCFG_ADKEY_LED_IO_REUSE || TCFG_ADKEY_IR_IO_REUSE || TCFG_ADKEY_LED_SPI_IO_REUSE)
|
||||
#else
|
||||
gpio_set_die(__this->adkey_pin, 0);
|
||||
gpio_set_direction(__this->adkey_pin, 1);
|
||||
gpio_set_pull_down(__this->adkey_pin, 0);
|
||||
if (__this->extern_up_en) {
|
||||
gpio_set_pull_up(__this->adkey_pin, 0);
|
||||
} else {
|
||||
gpio_set_pull_up(__this->adkey_pin, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if (TCFG_ADKEY_LED_IO_REUSE || TCFG_ADKEY_IR_IO_REUSE || TCFG_ADKEY_LED_SPI_IO_REUSE)
|
||||
|
||||
#if TCFG_ADKEY_IR_IO_REUSE
|
||||
static u8 ir_io_sus = 0;
|
||||
extern u8 ir_io_suspend(void);
|
||||
extern u8 ir_io_resume(void);
|
||||
#endif
|
||||
#if TCFG_ADKEY_LED_IO_REUSE
|
||||
static u8 led_io_sus = 0;
|
||||
extern u8 led_io_suspend(void);
|
||||
extern u8 led_io_resume(void);
|
||||
#endif
|
||||
#if TCFG_ADKEY_LED_SPI_IO_REUSE
|
||||
static u8 led_spi_sus = 0;
|
||||
extern u8 led_spi_suspend(void);
|
||||
extern u8 led_spi_resume(void);
|
||||
#endif
|
||||
u8 adc_io_reuse_enter(u32 ch)
|
||||
{
|
||||
if (ch == __this->ad_channel) {
|
||||
#if TCFG_ADKEY_IR_IO_REUSE
|
||||
if (ir_io_suspend()) {
|
||||
return 1;
|
||||
} else {
|
||||
ir_io_sus = 1;
|
||||
}
|
||||
#endif
|
||||
#if TCFG_ADKEY_LED_IO_REUSE
|
||||
if (led_io_suspend()) {
|
||||
return 1;
|
||||
} else {
|
||||
led_io_sus = 1;
|
||||
}
|
||||
#endif
|
||||
#if TCFG_ADKEY_LED_SPI_IO_REUSE
|
||||
if (led_spi_suspend()) {
|
||||
return 1;
|
||||
} else {
|
||||
led_spi_sus = 1;
|
||||
}
|
||||
#endif
|
||||
gpio_set_die(__this->adkey_pin, 0);
|
||||
gpio_set_direction(__this->adkey_pin, 1);
|
||||
gpio_set_pull_down(__this->adkey_pin, 0);
|
||||
if (__this->extern_up_en) {
|
||||
gpio_set_pull_up(__this->adkey_pin, 0);
|
||||
} else {
|
||||
gpio_set_pull_up(__this->adkey_pin, 1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 adc_io_reuse_exit(u32 ch)
|
||||
{
|
||||
if (ch == __this->ad_channel) {
|
||||
#if TCFG_ADKEY_IR_IO_REUSE
|
||||
if (ir_io_sus) {
|
||||
ir_io_sus = 0;
|
||||
ir_io_resume();
|
||||
}
|
||||
#endif
|
||||
#if TCFG_ADKEY_LED_IO_REUSE
|
||||
if (led_io_sus) {
|
||||
led_io_sus = 0;
|
||||
led_io_resume();
|
||||
}
|
||||
#endif
|
||||
#if TCFG_ADKEY_LED_SPI_IO_REUSE
|
||||
if (led_spi_sus) {
|
||||
led_spi_sus = 0;
|
||||
led_spi_resume();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* #if TCFG_ADKEY_ENABLE */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "key_driver.h"
|
||||
#include "adkey.h"
|
||||
#include "gpio.h"
|
||||
#include "system/event.h"
|
||||
#include "app_config.h"
|
||||
|
||||
|
||||
#if TCFG_ADKEY_ENABLE
|
||||
|
||||
static const struct adkey_platform_data *__this = NULL;
|
||||
|
||||
u8 ad_get_key_value(void);
|
||||
//按键驱动扫描参数列表
|
||||
struct key_driver_para adkey_scan_para = {
|
||||
.scan_time = 10, //按键扫描频率, 单位: ms
|
||||
.last_key = NO_KEY, //上一次get_value按键值, 初始化为NO_KEY;
|
||||
.filter_time = 2, //按键消抖延时;
|
||||
.long_time = 50, //按键判定长按数量
|
||||
.hold_time = (50 + 10), //按键判定HOLD数量
|
||||
.click_delay_time = 10, //按键被抬起后等待连击延时数量
|
||||
.key_type = KEY_DRIVER_TYPE_AD,
|
||||
.get_value = ad_get_key_value,
|
||||
};
|
||||
u8 ad_get_key_value(void)
|
||||
{
|
||||
u8 i;
|
||||
u16 ad_data;
|
||||
|
||||
if (!__this->enable) {
|
||||
return NO_KEY;
|
||||
}
|
||||
|
||||
/* ad_data = adc_get_voltage(__this->ad_channel); */
|
||||
ad_data = adc_get_value(__this->ad_channel);
|
||||
/* printf("ad_value = %d \n", ad_data); */
|
||||
for (i = 0; i < ADKEY_MAX_NUM; i++) {
|
||||
if ((ad_data <= __this->ad_value[i]) && (__this->ad_value[i] < 0x3ffL)) {
|
||||
return __this->key_value[i];
|
||||
}
|
||||
}
|
||||
return NO_KEY;
|
||||
}
|
||||
|
||||
int adkey_init(const struct adkey_platform_data *adkey_data)
|
||||
{
|
||||
__this = adkey_data;
|
||||
if (!__this) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!__this->enable) {
|
||||
return KEY_NOT_SUPPORT;
|
||||
}
|
||||
adc_add_sample_ch(__this->ad_channel); //注意:初始化AD_KEY之前,先初始化ADC
|
||||
#if (TCFG_ADKEY_LED_IO_REUSE || TCFG_ADKEY_IR_IO_REUSE || TCFG_ADKEY_LED_SPI_IO_REUSE)
|
||||
#else
|
||||
gpio_set_die(__this->adkey_pin, 0);
|
||||
gpio_set_direction(__this->adkey_pin, 1);
|
||||
gpio_set_pull_down(__this->adkey_pin, 0);
|
||||
if (__this->extern_up_en) {
|
||||
gpio_set_pull_up(__this->adkey_pin, 0);
|
||||
} else {
|
||||
gpio_set_pull_up(__this->adkey_pin, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if (TCFG_ADKEY_LED_IO_REUSE || TCFG_ADKEY_IR_IO_REUSE || TCFG_ADKEY_LED_SPI_IO_REUSE)
|
||||
|
||||
#if TCFG_ADKEY_IR_IO_REUSE
|
||||
static u8 ir_io_sus = 0;
|
||||
extern u8 ir_io_suspend(void);
|
||||
extern u8 ir_io_resume(void);
|
||||
#endif
|
||||
#if TCFG_ADKEY_LED_IO_REUSE
|
||||
static u8 led_io_sus = 0;
|
||||
extern u8 led_io_suspend(void);
|
||||
extern u8 led_io_resume(void);
|
||||
#endif
|
||||
#if TCFG_ADKEY_LED_SPI_IO_REUSE
|
||||
static u8 led_spi_sus = 0;
|
||||
extern u8 led_spi_suspend(void);
|
||||
extern u8 led_spi_resume(void);
|
||||
#endif
|
||||
u8 adc_io_reuse_enter(u32 ch)
|
||||
{
|
||||
if (ch == __this->ad_channel) {
|
||||
#if TCFG_ADKEY_IR_IO_REUSE
|
||||
if (ir_io_suspend()) {
|
||||
return 1;
|
||||
} else {
|
||||
ir_io_sus = 1;
|
||||
}
|
||||
#endif
|
||||
#if TCFG_ADKEY_LED_IO_REUSE
|
||||
if (led_io_suspend()) {
|
||||
return 1;
|
||||
} else {
|
||||
led_io_sus = 1;
|
||||
}
|
||||
#endif
|
||||
#if TCFG_ADKEY_LED_SPI_IO_REUSE
|
||||
if (led_spi_suspend()) {
|
||||
return 1;
|
||||
} else {
|
||||
led_spi_sus = 1;
|
||||
}
|
||||
#endif
|
||||
gpio_set_die(__this->adkey_pin, 0);
|
||||
gpio_set_direction(__this->adkey_pin, 1);
|
||||
gpio_set_pull_down(__this->adkey_pin, 0);
|
||||
if (__this->extern_up_en) {
|
||||
gpio_set_pull_up(__this->adkey_pin, 0);
|
||||
} else {
|
||||
gpio_set_pull_up(__this->adkey_pin, 1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 adc_io_reuse_exit(u32 ch)
|
||||
{
|
||||
if (ch == __this->ad_channel) {
|
||||
#if TCFG_ADKEY_IR_IO_REUSE
|
||||
if (ir_io_sus) {
|
||||
ir_io_sus = 0;
|
||||
ir_io_resume();
|
||||
}
|
||||
#endif
|
||||
#if TCFG_ADKEY_LED_IO_REUSE
|
||||
if (led_io_sus) {
|
||||
led_io_sus = 0;
|
||||
led_io_resume();
|
||||
}
|
||||
#endif
|
||||
#if TCFG_ADKEY_LED_SPI_IO_REUSE
|
||||
if (led_spi_sus) {
|
||||
led_spi_sus = 0;
|
||||
led_spi_resume();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* #if TCFG_ADKEY_ENABLE */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
#endif
|
||||
#else
|
||||
#ifndef ALL_KEY_EVENT_CLICK_ONLY
|
||||
#define ALL_KEY_EVENT_CLICK_ONLY 0 //是否全部按键只响应单击事件
|
||||
#define ALL_KEY_EVENT_CLICK_ONLY 1 //是否全部按键只响应单击事件
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -122,8 +122,8 @@ bool device_is_first_start()
|
||||
void led_update_start(void)
|
||||
{
|
||||
#ifdef UPDATE_LED_REMIND
|
||||
puts("led_update_start\n");
|
||||
kt_update_led_start();
|
||||
//puts("led_update_start\n");
|
||||
//kt_update_led_start();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ void led_update_finish(void)
|
||||
{
|
||||
#ifdef UPDATE_LED_REMIND
|
||||
puts("led_update_finish\n");
|
||||
kt_update_led_finish();
|
||||
//kt_update_led_finish();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ int update_result_deal()
|
||||
|
||||
#if defined(UPDATE_VOICE_REMIND) || defined(UPDATE_LED_REMIND)
|
||||
/* 升级完成:播 TONE_EUP(四通道全开),并恢复 SYS_LED 正常功能 */
|
||||
kt_update_finish_remind(result);
|
||||
//kt_update_finish_remind(result);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
|
||||
@ -17,6 +17,9 @@ enum
|
||||
#define KT_LED_SLOW_HALF 20
|
||||
#define KT_LED_FAST_HALF 2
|
||||
|
||||
/* 当前播的是非编号文件(如 aa.mp3),下一曲直接 play_next */
|
||||
#define KT_FILE_IDX_NONUM 0xFF
|
||||
|
||||
typedef struct _kt_var_
|
||||
{
|
||||
int kt_timer;
|
||||
@ -24,7 +27,7 @@ typedef struct _kt_var_
|
||||
u8 led_mode;
|
||||
u8 active_ch; /* 1~4 按键播放会话中, 0=无 */
|
||||
u8 fail_ch; /* 处于失败快闪的通道, 0=无 */
|
||||
u8 file_idx; /* 当前播放文件序号, 00/01/02... */
|
||||
u8 file_idx; /* 00/01/... 或 KT_FILE_IDX_NONUM */
|
||||
} _kt_var;
|
||||
|
||||
static _kt_var kt_var;
|
||||
@ -186,6 +189,7 @@ static void kt_gpio_out_init(u32 pin)
|
||||
{
|
||||
gpio_set_pull_down(pin, 0);
|
||||
gpio_set_pull_up(pin, 0);
|
||||
gpio_set_hd0(pin, 0);
|
||||
gpio_set_direction(pin, 0);
|
||||
gpio_set_output_value(pin, 0);
|
||||
}
|
||||
@ -273,25 +277,37 @@ static void timer_cb(void *priv)
|
||||
}
|
||||
|
||||
kt_led_bar_all_off();
|
||||
KUP_LED_OFF();
|
||||
KDOWN_LED_OFF();
|
||||
|
||||
if (on)
|
||||
{
|
||||
SYS_LED_ON();
|
||||
if (__this->led_mode == KT_LED_IDLE)
|
||||
{
|
||||
/* 待机:K1~K4 与音量灯同步慢闪 */
|
||||
kt_key_led_all_on();
|
||||
KUP_LED_ON();
|
||||
KDOWN_LED_ON();
|
||||
}
|
||||
else if (__this->led_mode == KT_LED_FAIL)
|
||||
{
|
||||
/* 失败:仅对应通道 KEY_LED + SYS 快闪,音量灯保持灭 */
|
||||
kt_key_led_on(__this->fail_ch);
|
||||
KUP_LED_OFF();
|
||||
KDOWN_LED_OFF();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 升级等:SYS 快闪,按键灯全亮忽明忽暗时由 UPDATE 模式另控 */
|
||||
KUP_LED_OFF();
|
||||
KDOWN_LED_OFF();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SYS_LED_OFF();
|
||||
kt_key_led_all_off();
|
||||
KUP_LED_OFF();
|
||||
KDOWN_LED_OFF();
|
||||
}
|
||||
}
|
||||
static void start_time_base(u32 time_base_ms)
|
||||
@ -308,7 +324,7 @@ static void start_time_base(u32 time_base_ms)
|
||||
static void kt_vol_reset_default(void)
|
||||
{
|
||||
app_audio_set_volume(APP_AUDIO_STATE_MUSIC, SYS_DEFAULT_VOL, 1);
|
||||
printf("kt vol reset to %d\n", SYS_DEFAULT_VOL);
|
||||
printf("kt vol reset to %d\n", SYS_DEFAULT_VOL);
|
||||
}
|
||||
|
||||
static void kt_update_play_tone(const char *name)
|
||||
@ -371,7 +387,7 @@ static void kt_update_play_tone(const char *name)
|
||||
kt_all_channels_off();
|
||||
}
|
||||
|
||||
void kt_update_led_start(void)
|
||||
/* void kt_update_led_start(void)
|
||||
{
|
||||
printf("kt_update_led_start\n");
|
||||
if (!__this->kt_timer)
|
||||
@ -379,24 +395,24 @@ void kt_update_led_start(void)
|
||||
start_time_base(50);
|
||||
}
|
||||
kt_led_set_mode(KT_LED_UPDATE);
|
||||
}
|
||||
} */
|
||||
|
||||
void kt_update_led_finish(void)
|
||||
/* void kt_update_led_finish(void)
|
||||
{
|
||||
printf("kt_update_led_finish\n");
|
||||
/* 升级结束:恢复 SYS_LED 正常空闲慢闪 */
|
||||
//升级结束:恢复 SYS_LED 正常空闲慢闪
|
||||
__this->fail_ch = 0;
|
||||
kt_led_set_mode(KT_LED_IDLE);
|
||||
}
|
||||
} */
|
||||
|
||||
void kt_update_start_remind(void)
|
||||
/* void kt_update_start_remind(void)
|
||||
{
|
||||
printf("kt_update_start_remind\n");
|
||||
kt_update_led_start();
|
||||
kt_update_play_tone(TONE_SUP);
|
||||
}
|
||||
} */
|
||||
|
||||
void kt_update_finish_remind(u16 result)
|
||||
/* void kt_update_finish_remind(u16 result)
|
||||
{
|
||||
printf("kt_update_finish_remind result=0x%x\n", result);
|
||||
if (result == UPDATA_SUCC)
|
||||
@ -404,7 +420,7 @@ void kt_update_finish_remind(u16 result)
|
||||
kt_update_play_tone(TONE_EUP);
|
||||
}
|
||||
kt_update_led_finish();
|
||||
}
|
||||
} */
|
||||
|
||||
void kt_init(void)
|
||||
{
|
||||
@ -477,6 +493,75 @@ static int kt_play_file_idx(u8 idx)
|
||||
return kt_try_play_path(path);
|
||||
}
|
||||
|
||||
/*
|
||||
* 不打断当前播放,仅探测编号文件是否存在。
|
||||
* 避免用 play_by_path 试探失败时 stop(1) 拆掉 fsn,导致后续 play_next 失败。
|
||||
*/
|
||||
static int kt_numbered_exists(u8 idx)
|
||||
{
|
||||
static const char *const roots[] = {
|
||||
"storage/sd1/C/",
|
||||
"storage/udisk0/C/",
|
||||
};
|
||||
static const char *const exts[] = {
|
||||
"mp3", "MP3", "wav", "WAV", "wma", "WMA",
|
||||
"flac", "FLA", "ape", "APE", "m4a", "M4A",
|
||||
};
|
||||
char path[64];
|
||||
FILE *fp;
|
||||
u8 r, e;
|
||||
|
||||
for (r = 0; r < ARRAY_SIZE(roots); r++)
|
||||
{
|
||||
for (e = 0; e < ARRAY_SIZE(exts); e++)
|
||||
{
|
||||
sprintf(path, "%s%02d.%s", roots[r], idx, exts[e]);
|
||||
fp = fopen(path, "r");
|
||||
if (fp)
|
||||
{
|
||||
fclose(fp);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 根据当前播放文件名同步 file_idx:NN.xxx → 序号,否则 NONUM */
|
||||
static u8 kt_file_idx_from_cur(void)
|
||||
{
|
||||
u8 name[64];
|
||||
u8 *p;
|
||||
int len;
|
||||
FILE *fp = music_player_get_file_hdl();
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
return KT_FILE_IDX_NONUM;
|
||||
}
|
||||
len = fget_name(fp, name, sizeof(name));
|
||||
if (len < 3)
|
||||
{
|
||||
return KT_FILE_IDX_NONUM;
|
||||
}
|
||||
p = name;
|
||||
if ((p[0] == '\\') && (p[1] == 'U'))
|
||||
{
|
||||
p += 2;
|
||||
if (len < 5)
|
||||
{
|
||||
return KT_FILE_IDX_NONUM;
|
||||
}
|
||||
}
|
||||
if ((p[0] >= '0') && (p[0] <= '9') &&
|
||||
(p[1] >= '0') && (p[1] <= '9') &&
|
||||
(p[2] == '.'))
|
||||
{
|
||||
return (u8)((p[0] - '0') * 10 + (p[1] - '0'));
|
||||
}
|
||||
return KT_FILE_IDX_NONUM;
|
||||
}
|
||||
|
||||
static void kt_play_success(u8 ch)
|
||||
{
|
||||
printf("kt_play_success ch=%d\n", ch);
|
||||
@ -527,20 +612,71 @@ static int kt_channel_key_handler(u8 ch)
|
||||
{
|
||||
if (__this->active_ch == ch)
|
||||
{
|
||||
/* 同通道:先尝试播放 idx+1(如 01→02),失败再用播放器自动下一曲 */
|
||||
u8 next_idx = __this->file_idx + 1;
|
||||
printf("kt_channel_key_handler same ch next_idx=%d\n", next_idx);
|
||||
err = kt_play_file_idx(next_idx);
|
||||
if (err == MUSIC_PLAYER_SUCC)
|
||||
/*
|
||||
* 同通道下一曲:
|
||||
* 1) 编号链:有 idx+1 则播编号(exists 探测,避免拆 fsn)
|
||||
* 2) 编号到头 → play_next 接非编号(aa.mp3 等)
|
||||
* 3) 非编号也播完(play_next 失败,或从非编号绕回编号区)→ 回绕 00(必存在)
|
||||
*/
|
||||
u8 from_nonum = (__this->file_idx == KT_FILE_IDX_NONUM);
|
||||
|
||||
if (!from_nonum)
|
||||
{
|
||||
__this->file_idx = next_idx;
|
||||
kt_play_success(ch);
|
||||
return MUSIC_PLAYER_SUCC;
|
||||
u8 next_idx = __this->file_idx + 1;
|
||||
printf("kt_channel_key_handler same ch next_idx=%d\n", next_idx);
|
||||
if (kt_numbered_exists(next_idx))
|
||||
{
|
||||
err = kt_play_file_idx(next_idx);
|
||||
if (err == MUSIC_PLAYER_SUCC)
|
||||
{
|
||||
__this->file_idx = next_idx;
|
||||
kt_play_success(ch);
|
||||
return MUSIC_PLAYER_SUCC;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("kt_channel_key_handler no more numbered, play_next\n");
|
||||
}
|
||||
}
|
||||
|
||||
err = music_player_play_next();
|
||||
if (err == MUSIC_PLAYER_SUCC)
|
||||
{
|
||||
__this->file_idx = next_idx;
|
||||
u8 idx = kt_file_idx_from_cur();
|
||||
/* 刚从非编号区绕回编号文件:统一回到 00 */
|
||||
if (from_nonum && (idx != KT_FILE_IDX_NONUM))
|
||||
{
|
||||
printf("kt_channel_key_handler nonum done, wrap to 00\n");
|
||||
if (idx == 0)
|
||||
{
|
||||
__this->file_idx = 0;
|
||||
kt_play_success(ch);
|
||||
return MUSIC_PLAYER_SUCC;
|
||||
}
|
||||
err = kt_play_file_idx(0);
|
||||
if (err == MUSIC_PLAYER_SUCC)
|
||||
{
|
||||
__this->file_idx = 0;
|
||||
kt_play_success(ch);
|
||||
return MUSIC_PLAYER_SUCC;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__this->file_idx = idx;
|
||||
printf("kt_channel_key_handler play_next ok file_idx=%d\n", __this->file_idx);
|
||||
kt_play_success(ch);
|
||||
return MUSIC_PLAYER_SUCC;
|
||||
}
|
||||
}
|
||||
|
||||
/* play_next 失败:回绕 00(需求保证存在) */
|
||||
printf("kt_channel_key_handler wrap to 00\n");
|
||||
err = kt_play_file_idx(0);
|
||||
if (err == MUSIC_PLAYER_SUCC)
|
||||
{
|
||||
__this->file_idx = 0;
|
||||
kt_play_success(ch);
|
||||
return MUSIC_PLAYER_SUCC;
|
||||
}
|
||||
@ -569,7 +705,9 @@ static int kt_channel_key_handler(u8 ch)
|
||||
err = kt_try_play_first_file();
|
||||
if (err == MUSIC_PLAYER_SUCC)
|
||||
{
|
||||
printf("kt_channel_key_handler idle play first ch=%d\n", ch);
|
||||
__this->file_idx = kt_file_idx_from_cur();
|
||||
printf("kt_channel_key_handler idle play first ch=%d file_idx=%d\n",
|
||||
ch, __this->file_idx);
|
||||
kt_play_success(ch);
|
||||
return MUSIC_PLAYER_SUCC;
|
||||
}
|
||||
@ -582,18 +720,16 @@ static int kt_vol_key_handler(u16 key)
|
||||
{
|
||||
if (key == KEY_USER_KEY_5)
|
||||
{
|
||||
/* 音量+,播放状态下两个音量键灯由统一状态机保持常亮 */
|
||||
//app_audio_volume_up(1);
|
||||
app_task_put_key_msg(KEY_VOL_UP,0);
|
||||
/* 音量+;KUP/KDOWN 灯不单独闪 3s,跟随 PLAY/IDLE 状态机 */
|
||||
app_task_put_key_msg(KEY_VOL_UP, 0);
|
||||
printf("kt vol+ %d\n", app_audio_get_volume(APP_AUDIO_CURRENT_STATE));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 音量-,播放状态下两个音量键灯由统一状态机保持常亮 */
|
||||
//app_audio_volume_down(1);
|
||||
/* 音量-;下限 2 */
|
||||
if (app_audio_get_volume(APP_AUDIO_STATE_MUSIC) > 2)
|
||||
{
|
||||
app_task_put_key_msg(KEY_VOL_DOWN,0);
|
||||
app_task_put_key_msg(KEY_VOL_DOWN, 0);
|
||||
}
|
||||
|
||||
printf("kt vol- %d\n", app_audio_get_volume(APP_AUDIO_CURRENT_STATE));
|
||||
@ -603,8 +739,8 @@ static int kt_vol_key_handler(u16 key)
|
||||
|
||||
/*
|
||||
* KEY1~4:空闲播 00.*;同通道 next;异通道只切输出;
|
||||
* 成功常亮,结束慢闪,失败快闪。
|
||||
* KEY5/6:音量 +/-;播放状态下两个音量键灯持续常亮。
|
||||
* 成功:当前 KEY_LED + KUP/KDOWN 常亮;结束慢闪;失败快闪。
|
||||
* KEY5/6:仅调音量;灯态:播放常亮,待机与其它按键灯同步慢闪。
|
||||
*/
|
||||
int kt_key_event_handler(u16 key)
|
||||
{
|
||||
|
||||
@ -22,10 +22,10 @@
|
||||
#define AUDIO_OUT_CH4_OFF() (gpio_set_output_value(AUDIO_OUT_CHANNEL4,0))
|
||||
|
||||
/* 播放按键LED输出通道 1-4*/
|
||||
#define KEY_LED_OUT_CHANNEL4 IO_PORTC_02
|
||||
#define KEY_LED_OUT_CHANNEL3 IO_PORTC_01
|
||||
#define KEY_LED_OUT_CHANNEL2 IO_PORTC_00
|
||||
#define KEY_LED_OUT_CHANNEL1 IO_PORTA_12
|
||||
#define KEY_LED_OUT_CHANNEL4 IO_PORTA_12
|
||||
#define KEY_LED_OUT_CHANNEL3 IO_PORTC_00
|
||||
#define KEY_LED_OUT_CHANNEL2 IO_PORTC_01
|
||||
#define KEY_LED_OUT_CHANNEL1 IO_PORTC_02
|
||||
#define KEY_LED_OUT_CH1_ON() (gpio_set_output_value(KEY_LED_OUT_CHANNEL1,1))
|
||||
#define KEY_LED_OUT_CH2_ON() (gpio_set_output_value(KEY_LED_OUT_CHANNEL2,1))
|
||||
#define KEY_LED_OUT_CH3_ON() (gpio_set_output_value(KEY_LED_OUT_CHANNEL3,1))
|
||||
@ -65,9 +65,9 @@ void kt_boot_init(void);
|
||||
void kt_init(void);
|
||||
|
||||
/* SD/U盘升级提示:SYS_LED 快闪 + 提示音(四通道全开) */
|
||||
void kt_update_led_start(void);
|
||||
void kt_update_led_finish(void);
|
||||
void kt_update_start_remind(void);
|
||||
void kt_update_finish_remind(u16 result);
|
||||
//void kt_update_led_start(void);
|
||||
//void kt_update_led_finish(void);
|
||||
//void kt_update_start_remind(void);
|
||||
//void kt_update_finish_remind(u16 result);
|
||||
|
||||
#endif
|
||||
|
||||
@ -681,12 +681,12 @@ static int music_key_event_opr(struct sys_event *event)
|
||||
break;
|
||||
case KEY_USER_KEY_5:
|
||||
printf("KEY_USER_KEY_5\n");
|
||||
//改为音量+,可对接KEY_VOL_UP,同时KUP_LED_PIN常亮3秒后进入慢闪
|
||||
/* 音量+:灯态由 kt LED 状态机统一处理(播放常亮 / 待机同步慢闪) */
|
||||
err = kt_key_event_handler(KEY_USER_KEY_5);
|
||||
break;
|
||||
case KEY_USER_KEY_6:
|
||||
printf("KEY_USER_KEY_6\n");
|
||||
//改为音量-,可对接KEY_VOL_DOWN,同时KDOWN_LED_PIN常亮3秒后进入慢闪
|
||||
/* 音量-:灯态由 kt LED 状态机统一处理(播放常亮 / 待机同步慢闪) */
|
||||
err = kt_key_event_handler(KEY_USER_KEY_6);
|
||||
break;
|
||||
case KEY_MUSIC_PLAYER_START:
|
||||
|
||||
@ -139,7 +139,9 @@ static int audio_vol_set(u8 gain_l, u8 gain_r, u8 gain_rl, u8 gain_rr, u8 fade)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#if (AUDIO_OUTPUT_WAY == AUDIO_OUTPUT_WAY_IIS)
|
||||
/* DAC+IIS 双输出时,IIS 数字音量节点已在 audio_dec.c 创建(AUDIO_OUTPUT_INCLUDE_IIS),
|
||||
* 音量键需同步更新 iis_digvol,否则仅 DAC 模拟增益变化、光纤数字输出音量不变。 */
|
||||
#if AUDIO_OUTPUT_INCLUDE_IIS
|
||||
extern void *iis_digvol_last;
|
||||
if (iis_digvol_last) {
|
||||
audio_dig_vol_set(iis_digvol_last, AUDIO_DIG_VOL_ALL_CH, gain_l);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_059D.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_059D.ufw
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_3B24.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_3B24.ufw
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_5E96.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_5E96.ufw
Normal file
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_78AB.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_78AB.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_7C4E.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_7C4E.ufw
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_B335.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_B335.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_B6A0.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_B6A0.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_BD0B.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_BD0B.ufw
Normal file
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_F392.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_F392.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_F9E6.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_F9E6.ufw
Normal file
Binary file not shown.
@ -260,7 +260,6 @@ objs/apps/common/dev_manager/dev_update.c.o
|
||||
-r=objs/apps/common/dev_manager/dev_update.c.o,sprintf,l
|
||||
-r=objs/apps/common/dev_manager/dev_update.c.o,dev_manager_get_root_path,l
|
||||
-r=objs/apps/common/dev_manager/dev_update.c.o,fopen,l
|
||||
-r=objs/apps/common/dev_manager/dev_update.c.o,kt_update_start_remind,l
|
||||
-r=objs/apps/common/dev_manager/dev_update.c.o,app_active_update_task_init,l
|
||||
-r=objs/apps/common/dev_manager/dev_update.c.o,update_mode_api_v2,l
|
||||
-r=objs/apps/common/dev_manager/dev_update.c.o,strlen,l
|
||||
@ -1511,11 +1510,8 @@ objs/apps/common/update/update.c.o
|
||||
-r=objs/apps/common/update/update.c.o,log_print,l
|
||||
-r=objs/apps/common/update/update.c.o,puts,l
|
||||
-r=objs/apps/common/update/update.c.o,led_update_start,pl
|
||||
-r=objs/apps/common/update/update.c.o,kt_update_led_start,l
|
||||
-r=objs/apps/common/update/update.c.o,led_update_finish,pl
|
||||
-r=objs/apps/common/update/update.c.o,kt_update_led_finish,l
|
||||
-r=objs/apps/common/update/update.c.o,update_result_deal,pl
|
||||
-r=objs/apps/common/update/update.c.o,kt_update_finish_remind,l
|
||||
-r=objs/apps/common/update/update.c.o,clr_update_ram_info,pl
|
||||
-r=objs/apps/common/update/update.c.o,set_loader_start_addr,pl
|
||||
-r=objs/apps/common/update/update.c.o,update_close_hw,pl
|
||||
@ -1870,33 +1866,25 @@ objs/apps/kaotings/kt.c.o
|
||||
-r=objs/apps/kaotings/kt.c.o,gpio_set_direction,l
|
||||
-r=objs/apps/kaotings/kt.c.o,gpio_set_output_value,l
|
||||
-r=objs/apps/kaotings/kt.c.o,gpio_set_die,l
|
||||
-r=objs/apps/kaotings/kt.c.o,kt_update_led_start,pl
|
||||
-r=objs/apps/kaotings/kt.c.o,printf,l
|
||||
-r=objs/apps/kaotings/kt.c.o,kt_update_led_finish,pl
|
||||
-r=objs/apps/kaotings/kt.c.o,kt_update_start_remind,pl
|
||||
-r=objs/apps/kaotings/kt.c.o,kt_update_finish_remind,pl
|
||||
-r=objs/apps/kaotings/kt.c.o,kt_init,pl
|
||||
-r=objs/apps/kaotings/kt.c.o,printf,l
|
||||
-r=objs/apps/kaotings/kt.c.o,kt_music_play_end_handler,pl
|
||||
-r=objs/apps/kaotings/kt.c.o,music_player_stop,l
|
||||
-r=objs/apps/kaotings/kt.c.o,kt_key_event_handler,pl
|
||||
-r=objs/apps/kaotings/kt.c.o,gpio_set_hd0,l
|
||||
-r=objs/apps/kaotings/kt.c.o,app_audio_set_volume,l
|
||||
-r=objs/apps/kaotings/kt.c.o,sys_timer_del,l
|
||||
-r=objs/apps/kaotings/kt.c.o,sys_timer_add,l
|
||||
-r=objs/apps/kaotings/kt.c.o,tone_play_stop,l
|
||||
-r=objs/apps/kaotings/kt.c.o,music_player_get_play_status,l
|
||||
-r=objs/apps/kaotings/kt.c.o,os_time_dly,l
|
||||
-r=objs/apps/kaotings/kt.c.o,app_audio_output_start,l
|
||||
-r=objs/apps/kaotings/kt.c.o,app_audio_state_switch,l
|
||||
-r=objs/apps/kaotings/kt.c.o,get_max_sys_vol,l
|
||||
-r=objs/apps/kaotings/kt.c.o,app_audio_set_volume,l
|
||||
-r=objs/apps/kaotings/kt.c.o,tone_play,l
|
||||
-r=objs/apps/kaotings/kt.c.o,wdt_clear,l
|
||||
-r=objs/apps/kaotings/kt.c.o,tone_get_dec_status,l
|
||||
-r=objs/apps/kaotings/kt.c.o,tone_get_status,l
|
||||
-r=objs/apps/kaotings/kt.c.o,app_task_put_key_msg,l
|
||||
-r=objs/apps/kaotings/kt.c.o,app_audio_get_volume,l
|
||||
-r=objs/apps/kaotings/kt.c.o,music_player_get_play_status,l
|
||||
-r=objs/apps/kaotings/kt.c.o,music_player_play_next,l
|
||||
-r=objs/apps/kaotings/kt.c.o,sprintf,l
|
||||
-r=objs/apps/kaotings/kt.c.o,fopen,l
|
||||
-r=objs/apps/kaotings/kt.c.o,fclose,l
|
||||
-r=objs/apps/kaotings/kt.c.o,music_player_play_by_path,l
|
||||
-r=objs/apps/kaotings/kt.c.o,music_player_get_file_hdl,l
|
||||
-r=objs/apps/kaotings/kt.c.o,fget_name,l
|
||||
-r=objs/apps/kaotings/kt.c.o,music_player_play_first_file,l
|
||||
-r=objs/apps/kaotings/kt.c.o,puts,l
|
||||
objs/apps/soundbox/board/br23/board_ac6083a/board_ac6083a.c.o
|
||||
@ -3559,6 +3547,7 @@ objs/cpu/br23/audio_common/app_audio.c.o
|
||||
-r=objs/cpu/br23/audio_common/app_audio.c.o,audio_output_sync_stop,pl
|
||||
-r=objs/cpu/br23/audio_common/app_audio.c.o,audio_adda_dump,pl
|
||||
-r=objs/cpu/br23/audio_common/app_audio.c.o,audio_adda_gain_dump,pl
|
||||
-r=objs/cpu/br23/audio_common/app_audio.c.o,audio_dig_vol_set,l
|
||||
-r=objs/cpu/br23/audio_common/app_audio.c.o,local_irq_disable,l
|
||||
-r=objs/cpu/br23/audio_common/app_audio.c.o,audio_dac_vol_set,l
|
||||
-r=objs/cpu/br23/audio_common/app_audio.c.o,local_irq_enable,l
|
||||
@ -3577,6 +3566,7 @@ objs/cpu/br23/audio_common/app_audio.c.o
|
||||
-r=objs/cpu/br23/audio_common/app_audio.c.o,default_dac,l
|
||||
-r=objs/cpu/br23/audio_common/app_audio.c.o,dac_sem,pl
|
||||
-r=objs/cpu/br23/audio_common/app_audio.c.o,mc_sem,pl
|
||||
-r=objs/cpu/br23/audio_common/app_audio.c.o,iis_digvol_last,l
|
||||
objs/cpu/br23/audio_common/audio_fmtx.c.o
|
||||
objs/cpu/br23/audio_common/audio_iis.c.o
|
||||
-r=objs/cpu/br23/audio_common/audio_iis.c.o,audio_iis_src_output_handler,pl
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user