Compare commits
3 Commits
main
...
QingMa_JM6
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ce8c8afa9 | |||
| 1181c27f7c | |||
| da93862859 |
2
.vscode/c_cpp_properties.json
vendored
2
.vscode/c_cpp_properties.json
vendored
@ -74,10 +74,12 @@
|
||||
"${workspaceFolder}/include_lib\\media\\media_develop\\media\\cpu\\br23",
|
||||
"${workspaceFolder}/include_lib\\media\\media_develop\\media\\cpu\\br23\\asm",
|
||||
"${workspaceFolder}/cpu\\br23\\audio_mic",
|
||||
"${workspaceFolder}/apps\\kaotings",
|
||||
"${workspaceFolder}/apps\\soundbox\\include",
|
||||
"${workspaceFolder}/apps\\soundbox\\include\\task_manager",
|
||||
"${workspaceFolder}/apps\\soundbox\\include\\task_manager\\bt",
|
||||
"${workspaceFolder}/apps\\soundbox\\include\\user_api",
|
||||
"${workspaceFolder}/apps\\soundbox\\board\\br23",
|
||||
"${workspaceFolder}/apps\\common",
|
||||
"${workspaceFolder}/apps\\common\\device",
|
||||
"${workspaceFolder}/apps\\common\\audio",
|
||||
|
||||
9
.vscode/settings.json
vendored
Normal file
9
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"gsensor_manage.h": "c",
|
||||
"bt_emitter.h": "c",
|
||||
"kt.h": "c",
|
||||
"iis.h": "c",
|
||||
"linein.h": "c"
|
||||
}
|
||||
}
|
||||
4
Makefile
4
Makefile
@ -82,6 +82,7 @@ CFLAGS := \
|
||||
-fprefer-gnu-section \
|
||||
-Wno-shift-negative-value \
|
||||
-fms-extensions \
|
||||
-w \
|
||||
|
||||
|
||||
# C++额外的编译参数
|
||||
@ -206,6 +207,7 @@ INCLUDES := \
|
||||
-Iapps/common/usb \
|
||||
-Iapps/common/usb/device \
|
||||
-Iapps/common/usb/host \
|
||||
-Iapps/kaotings \
|
||||
-Iapps/soundbox/smartbox \
|
||||
-Iapps/soundbox/smartbox/bt_manage/bt_trans_data \
|
||||
-Iapps/soundbox/smartbox/bt_manage \
|
||||
@ -574,6 +576,8 @@ c_SRC_FILES := \
|
||||
apps/soundbox/soundcard/notice.c \
|
||||
apps/soundbox/soundcard/peripheral.c \
|
||||
apps/soundbox/soundcard/soundcard.c \
|
||||
apps/kaotings/kt.c \
|
||||
apps/kaotings/kt_dbg.c \
|
||||
apps/soundbox/task_manager/app_common.c \
|
||||
apps/soundbox/task_manager/app_task_switch.c \
|
||||
apps/soundbox/task_manager/bt/bt.c \
|
||||
|
||||
679
apps/kaotings/kt.c
Normal file
679
apps/kaotings/kt.c
Normal file
@ -0,0 +1,679 @@
|
||||
#include "kt.h"
|
||||
#include "kt_dbg.h"
|
||||
#include "bt.h"
|
||||
#include "bt_emitter.h"
|
||||
#include "asm/mcpwm.h"
|
||||
#include "avctp_user.h"
|
||||
#include "key_event_deal.h"
|
||||
#include "audio_config.h"
|
||||
#include "app_task.h"
|
||||
#include "app_main.h"
|
||||
#include "bt_emitter.h"
|
||||
// #include "task_manager/linein/linein.h"
|
||||
#include "bt.h"
|
||||
|
||||
extern int linein_volume_set(u8 vol);
|
||||
extern void mcpwm_init(struct pwm_platform_data *arg);
|
||||
|
||||
typedef struct _kt_var_
|
||||
{
|
||||
// u16 tid;
|
||||
struct kt
|
||||
{
|
||||
u16 tid;
|
||||
int chk_cnt;
|
||||
int led_cnt;
|
||||
} tim;
|
||||
|
||||
struct
|
||||
{
|
||||
u8 curr_mode;
|
||||
u8 last_mode;
|
||||
u8 next_mode;
|
||||
u8 user_role;
|
||||
int cnt;
|
||||
} mode;
|
||||
|
||||
// u8 curr_task_mode;
|
||||
// u8 mode;
|
||||
} _kt_var;
|
||||
|
||||
static _kt_var kt_var;
|
||||
#define __this (&kt_var)
|
||||
|
||||
static char *mode_name[] = {
|
||||
"MODE_AUX_LP",
|
||||
"MODE_BT_EMITTER",
|
||||
"MODE_BT_RECEIVER",
|
||||
};
|
||||
|
||||
u8 kt_get_mode(void)
|
||||
{
|
||||
u32 adc_value = 0;
|
||||
// int cnt = 0;
|
||||
// u8 temp_mode = 0;
|
||||
|
||||
adc_value = adc_get_value(CFG_MODE_AD_CH);
|
||||
// printf("----------->>>>>>>>>>>>>>> adc_value = %d <<<<<<<<<<<----------\n", adc_value);
|
||||
if (adc_value > 80 && adc_value < 150)
|
||||
{
|
||||
// printf("----------->>>>>>>>>>>>>>> temp_mode = MODE_AUX_LP <<<<<<<<<<<----------\n");
|
||||
return MODE_AUX_LP;
|
||||
}
|
||||
else if (adc_value > 330 && adc_value < 370)
|
||||
{
|
||||
// printf("----------->>>>>>>>>>>>>>> temp_mode = MODE_BT_RECEIVER <<<<<<<<<<<----------\n");
|
||||
return MODE_BT_RECEIVER;
|
||||
}
|
||||
else if (adc_value > 500 && adc_value < 600)
|
||||
{
|
||||
return MODE_BT_EMITTER;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MODE_ERROR;
|
||||
}
|
||||
#if 0
|
||||
while (1)
|
||||
{
|
||||
adc_value = adc_get_value(CFG_MODE_AD_CH);
|
||||
|
||||
|
||||
if (adc_value > 80 && adc_value < 100)
|
||||
{
|
||||
if (temp_mode != MODE_AUX_LP)
|
||||
{
|
||||
temp_mode = MODE_AUX_LP;
|
||||
cnt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cnt++;
|
||||
if (cnt >= 3)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (adc_value > 330 && adc_value < 370)
|
||||
{
|
||||
if (temp_mode != MODE_BT_RECEIVER)
|
||||
{
|
||||
temp_mode = MODE_BT_RECEIVER;
|
||||
cnt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cnt++;
|
||||
if (cnt >= 3)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (temp_mode != MODE_BT_EMITTER)
|
||||
{
|
||||
temp_mode = MODE_BT_EMITTER;
|
||||
cnt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cnt++;
|
||||
if (cnt >= 3)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
clr_wdt();
|
||||
os_time_dly(1);
|
||||
}
|
||||
printf("----------->>>>>>>>>>>>>>> temp_mode = %s <<<<<<<<<<<----------\n", mode_name[temp_mode]);
|
||||
return temp_mode;
|
||||
#endif
|
||||
}
|
||||
|
||||
void kt_set_curr_mode(u8 mode)
|
||||
{
|
||||
__this->mode.curr_mode = mode;
|
||||
}
|
||||
|
||||
u8 kt_get_curr_mode(void)
|
||||
{
|
||||
return __this->mode.curr_mode;
|
||||
}
|
||||
|
||||
void kt_boot_init(void)
|
||||
{
|
||||
log_i("kt_boot_init");
|
||||
// mute pin
|
||||
gpio_set_pull_down(CFG_MUTE_PIN, 0);
|
||||
gpio_set_pull_up(CFG_MUTE_PIN, 0);
|
||||
gpio_set_direction(CFG_MUTE_PIN, 0);
|
||||
PA_MUTE();
|
||||
|
||||
/* 初始化Kaotings调试系统,默认INFO级别 */
|
||||
kt_dbg_set_level(_DBG_LEVEL_);
|
||||
KT_LOGI("KT", "dbg ready @level=%d", kt_dbg_get_level());
|
||||
// volume pin adc ch
|
||||
gpio_set_die(CFG_VOLUME_PIN, 0);
|
||||
gpio_set_direction(CFG_VOLUME_PIN, 1);
|
||||
gpio_set_pull_down(CFG_VOLUME_PIN, 0);
|
||||
gpio_set_pull_up(CFG_VOLUME_PIN, 1);
|
||||
adc_add_sample_ch(CFG_VOLUME_AD_CH);
|
||||
// mode pin adc ch
|
||||
gpio_set_die(CFG_MODE_PIN, 0);
|
||||
gpio_set_direction(CFG_MODE_PIN, 1);
|
||||
gpio_set_pull_down(CFG_MODE_PIN, 0);
|
||||
gpio_set_pull_up(CFG_MODE_PIN, 1);
|
||||
adc_add_sample_ch(CFG_MODE_AD_CH);
|
||||
// lp mot pin
|
||||
gpio_set_pull_down(CFG_LP_MOT_PIN, 0);
|
||||
gpio_set_pull_up(CFG_LP_MOT_PIN, 0);
|
||||
gpio_set_direction(CFG_LP_MOT_PIN, 0);
|
||||
LP_MOT_OFF();
|
||||
// pa pwr pin
|
||||
gpio_set_pull_down(CFG_PA_PWR_PIN, 0);
|
||||
gpio_set_pull_up(CFG_PA_PWR_PIN, 0);
|
||||
gpio_set_direction(CFG_PA_PWR_PIN, 0);
|
||||
PA_PWR_OFF();
|
||||
// led red pin
|
||||
gpio_set_pull_down(CFG_LED_RED_PIN, 0);
|
||||
gpio_set_pull_up(CFG_LED_RED_PIN, 0);
|
||||
gpio_set_direction(CFG_LED_RED_PIN, 0);
|
||||
LED_RED_OFF();
|
||||
// led blue pin
|
||||
gpio_set_pull_down(CFG_LED_BLUE_PIN, 0);
|
||||
gpio_set_pull_up(CFG_LED_BLUE_PIN, 0);
|
||||
gpio_set_direction(CFG_LED_BLUE_PIN, 0);
|
||||
LED_BLUE_OFF();
|
||||
|
||||
gpio_set_pull_down(IO_PORTC_03, 0);
|
||||
gpio_set_pull_up(IO_PORTC_03, 0);
|
||||
gpio_set_direction(IO_PORTC_03, 0);
|
||||
gpio_set_output_value(IO_PORTC_03, 1);
|
||||
|
||||
struct pwm_platform_data pwm_p_data;
|
||||
|
||||
pwm_p_data.pwm_aligned_mode = pwm_edge_aligned; // 边沿对齐
|
||||
pwm_p_data.frequency = 20000; // 1KHz
|
||||
// pwm_p_data.frequency = 50000; //1KHz
|
||||
|
||||
pwm_p_data.pwm_ch_num = pwm_ch5; // 通道0
|
||||
pwm_p_data.pwm_timer_num = pwm_timer5; // 时基选择通道0
|
||||
pwm_p_data.duty = 5000; // 占空比50%
|
||||
pwm_p_data.h_pin = IO_PORTC_04; // 没有则填 -1。h_pin_output_ch_num无效,可不配置
|
||||
pwm_p_data.l_pin = -1; // 硬件引脚,l_pin_output_ch_num无效,可不配置
|
||||
pwm_p_data.complementary_en = 1; // 两个引脚的波形同步
|
||||
|
||||
mcpwm_init(&pwm_p_data);
|
||||
}
|
||||
|
||||
static void mode_led_flash(void)
|
||||
{
|
||||
static int cnt = 0;
|
||||
// printf("---------------> mode_led_flash %s <---------------\n", mode_name[__this->mode.curr_mode]);
|
||||
if (__this->mode.curr_mode == MODE_BT_RECEIVER)
|
||||
{
|
||||
LED_RED_OFF();
|
||||
// printf("1-%d\n", get_bt_connect_status());
|
||||
if (get_bt_connect_status() < BT_STATUS_CONNECTING)
|
||||
{
|
||||
__this->tim.led_cnt++;
|
||||
if (__this->tim.led_cnt < 20)
|
||||
{
|
||||
LED_BLUE_ON();
|
||||
}
|
||||
else if (__this->tim.led_cnt < 40)
|
||||
{
|
||||
LED_BLUE_OFF();
|
||||
}
|
||||
else
|
||||
{
|
||||
__this->tim.led_cnt = 0;
|
||||
LED_BLUE_ON();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LED_BLUE_ON();
|
||||
}
|
||||
}
|
||||
else if (__this->mode.curr_mode == MODE_BT_EMITTER)
|
||||
{
|
||||
// LED_RED_OFF();
|
||||
// printf("2-%d\n", get_bt_connect_status());
|
||||
|
||||
/* if(cnt++ > 40)
|
||||
{
|
||||
cnt = 0;
|
||||
printf("2-%d\n", get_bt_connect_status());
|
||||
} */
|
||||
// printf("---------------> get_bt_connect_status %d <---------------\n", get_bt_connect_status());
|
||||
if (get_total_connect_dev() == 0)
|
||||
{
|
||||
__this->tim.led_cnt++;
|
||||
if (__this->tim.led_cnt < 8)
|
||||
{
|
||||
LED_RED_ON();
|
||||
LED_BLUE_ON();
|
||||
}
|
||||
else if (__this->tim.led_cnt < 16)
|
||||
{
|
||||
LED_RED_OFF();
|
||||
LED_BLUE_OFF();
|
||||
}
|
||||
else
|
||||
{
|
||||
__this->tim.led_cnt = 0;
|
||||
LED_RED_ON();
|
||||
LED_BLUE_ON();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LED_RED_ON();
|
||||
LED_BLUE_ON();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LED_BLUE_OFF();
|
||||
LED_RED_ON();
|
||||
LP_MOT_ON();
|
||||
}
|
||||
}
|
||||
|
||||
static void mode_check(void)
|
||||
{
|
||||
u8 mode = kt_get_mode();
|
||||
if (mode != __this->mode.next_mode)
|
||||
{
|
||||
__this->mode.next_mode = mode;
|
||||
__this->mode.cnt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
__this->mode.cnt++;
|
||||
if (__this->mode.cnt >= 3)
|
||||
{
|
||||
if (mode == __this->mode.curr_mode)
|
||||
{
|
||||
__this->mode.cnt = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
__this->mode.cnt = 0;
|
||||
app_task_put_key_msg(KEY_MSG_MODE_CHANGE, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void volume_check(void)
|
||||
{
|
||||
static u32 last_vol_value = 0;
|
||||
u32 temp = adc_get_value(CFG_VOLUME_AD_CH);
|
||||
if (temp > last_vol_value + 3)
|
||||
{
|
||||
last_vol_value = temp;
|
||||
app_task_put_key_msg(KEY_MSG_VOLUME_CHANGE, temp);
|
||||
}
|
||||
else if (temp < last_vol_value - 3)
|
||||
{
|
||||
last_vol_value = temp;
|
||||
app_task_put_key_msg(KEY_MSG_VOLUME_CHANGE, temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
// last_vol_value = temp;
|
||||
}
|
||||
}
|
||||
|
||||
// int test = 0;
|
||||
static void timer_callback(void *priv)
|
||||
{
|
||||
// volume_check();
|
||||
// mode_check();
|
||||
mode_led_flash();
|
||||
__this->tim.chk_cnt++;
|
||||
if (__this->tim.chk_cnt == 3)
|
||||
{
|
||||
//__this->tim.chk_cnt = 0;
|
||||
app_task_put_key_msg(KEY_MSG_VOLUME_CHK, 0);
|
||||
}
|
||||
else if (__this->tim.chk_cnt == 5)
|
||||
{
|
||||
app_task_put_key_msg(KEY_MSG_MODE_CHK, 0);
|
||||
}
|
||||
else if (__this->tim.chk_cnt > 5)
|
||||
{
|
||||
__this->tim.chk_cnt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
/* test++;
|
||||
if (test > 100)
|
||||
{
|
||||
test = 0;
|
||||
app_task_put_key_msg(KEY_MSG_EQ_TEST_CHANGE, 0);
|
||||
} */
|
||||
}
|
||||
|
||||
static void start_timer(void)
|
||||
{
|
||||
if (__this->tim.tid != 0)
|
||||
{
|
||||
sys_timer_del(__this->tim.tid);
|
||||
}
|
||||
__this->tim.led_cnt = 0;
|
||||
__this->tim.chk_cnt = 0;
|
||||
__this->tim.tid = sys_timer_add(NULL, timer_callback, 20);
|
||||
}
|
||||
|
||||
void kt_init(void)
|
||||
{
|
||||
PA_PWR_ON();
|
||||
start_timer();
|
||||
}
|
||||
|
||||
u8 kt_get_user_role(void)
|
||||
{
|
||||
return __this->mode.user_role;
|
||||
}
|
||||
|
||||
static u8 kt_mode_change(u8 mode)
|
||||
{
|
||||
printf("----------->>>>>>>>>>>>>>> curr_mode[%s] to [%s] <<<<<<<<<<<----------\n", mode_name[__this->mode.curr_mode], mode_name[mode]);
|
||||
if (mode == MODE_BT_RECEIVER)
|
||||
{
|
||||
printf("switch to receiver mode\n");
|
||||
__this->mode.user_role = MODE_BT_RECEIVER;
|
||||
LP_MOT_OFF();
|
||||
// 判断当前是否在蓝牙模式
|
||||
if (app_get_curr_task() != APP_BT_TASK)
|
||||
{
|
||||
// 如果当前不在蓝牙模式,还需要判断当前是否是发射模式,直接切换回发生蓝牙冲入错误,造成死机
|
||||
printf("current task is not bt task, need check emitter role and switch to bt task\n");
|
||||
if (__this->mode.curr_mode == MODE_BT_EMITTER)
|
||||
{
|
||||
printf("current is emitter, need switch to receiver\n");
|
||||
emitter_or_receiver_switch(BT_RECEIVER_EN);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 当前仅仅是Linein模式,直接切换到蓝牙模式
|
||||
printf("current is linein, need switch to bt task\n");
|
||||
app_task_switch_to(APP_BT_TASK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 当前已经是蓝牙模式,再判断当前角色是否是发射器
|
||||
if (bt_emitter_role_get() == BT_EMITTER_EN)
|
||||
{
|
||||
printf("current is emitter, need switch to receiver\n");
|
||||
emitter_or_receiver_switch(BT_RECEIVER_EN);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("current is receiver, no need switch\n");
|
||||
// emitter_or_receiver_switch(BT_RECEIVER_EN);
|
||||
}
|
||||
}
|
||||
return MODE_BT_RECEIVER;
|
||||
}
|
||||
else if (mode == MODE_BT_EMITTER)
|
||||
{
|
||||
__this->mode.user_role = MODE_BT_EMITTER;
|
||||
LP_MOT_ON();
|
||||
// printf("----------->>>>>>>>>>>>>>> switch to APP_LINEIN_TASK <<<<<<<<<<<----------\n");
|
||||
// 需要切换到发射模式,首先判断当前是否在蓝牙模式
|
||||
if (app_get_curr_task() == APP_BT_TASK)
|
||||
{
|
||||
printf("current task is bt task\n");
|
||||
// 当前在蓝牙模式 需要判断当前角色是否是接收器
|
||||
if (bt_emitter_role_get() == BT_RECEIVER_EN)
|
||||
{
|
||||
// 当前是接收器 需要切换到发射器
|
||||
printf("current is receiver, need switch to emitter\n");
|
||||
emitter_or_receiver_switch(BT_EMITTER_EN);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 当前已经是发射器 不需要切换
|
||||
printf("current is emitter, no need switch\n");
|
||||
// emitter_or_receiver_switch(BT_RECEIVER_EN);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 当前不在蓝牙模式 需要切换到蓝牙模式,
|
||||
printf("current task is not bt task, need switch to bt task\n");
|
||||
// 在蓝牙连接成功后会自动切换到LINEIN模式
|
||||
printf("mode switch in connnected after bt task\n");
|
||||
app_task_switch_to(APP_BT_TASK);
|
||||
}
|
||||
return MODE_BT_EMITTER;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("switch to aux lp mode\n");
|
||||
__this->mode.user_role = MODE_AUX_LP;
|
||||
LP_MOT_ON();
|
||||
// 当前模式是否在发射模式,如果是在发射模式,需要先关闭连接和搜索
|
||||
if (__this->mode.curr_mode == MODE_BT_EMITTER)
|
||||
{
|
||||
if (get_total_connect_dev() > 0)
|
||||
{
|
||||
user_send_cmd_prepare(USER_CTRL_POWER_OFF, 0, NULL);
|
||||
}
|
||||
|
||||
printf("current mode is emitter, need close connection and search\n");
|
||||
emitter_or_receiver_switch(BT_RECEIVER_EN);
|
||||
bt_emitter_stop_search_device();
|
||||
}
|
||||
|
||||
// 判断当前是否在LINEIN模式
|
||||
if (app_get_curr_task() == APP_LINEIN_TASK)
|
||||
{
|
||||
// 当前在蓝牙模式 直接切换到LINEIN模式
|
||||
printf("current task is linein task, no need switch\n");
|
||||
app_task_switch_to(APP_LINEIN_TASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 当前不在Linein模式 需要切换到Linein模式,
|
||||
printf("current task is not linein task, need switch to linein task\n");
|
||||
app_task_switch_to(APP_LINEIN_TASK);
|
||||
}
|
||||
return MODE_AUX_LP;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
if (app_get_curr_task() != APP_LINEIN_TASK)
|
||||
{
|
||||
printf("----------->>>>>>>>>>>>>>> %s %d <<<<<<<<<<<----------\n", __func__, __LINE__);
|
||||
app_task_switch_to(APP_LINEIN_TASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("----------->>>>>>>>>>>>>>> %s %d <<<<<<<<<<<----------\n", __func__, __LINE__);
|
||||
if (bt_emitter_role_get() == BT_RECEIVER_EN)
|
||||
{
|
||||
printf("----------->>>>>>>>>>>>>>> %s %d <<<<<<<<<<<----------\n", __func__, __LINE__);
|
||||
emitter_or_receiver_switch(BT_EMITTER_EN);
|
||||
}
|
||||
}
|
||||
return MODE_BT_EMITTER;
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf("----------->>>>>>>>>>>>>>> %s %d <<<<<<<<<<<----------\n", __func__, __LINE__);
|
||||
if (app_get_curr_task() != APP_LINEIN_TASK)
|
||||
{
|
||||
printf("----------->>>>>>>>>>>>>>> %s %d <<<<<<<<<<<----------\n", __func__, __LINE__);
|
||||
app_task_switch_to(APP_LINEIN_TASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("----------->>>>>>>>>>>>>>> %s %d <<<<<<<<<<<----------\n", __func__, __LINE__);
|
||||
if (bt_emitter_role_get() == BT_EMITTER_EN)
|
||||
{
|
||||
printf("----------->>>>>>>>>>>>>>> %s %d <<<<<<<<<<<----------\n", __func__, __LINE__);
|
||||
emitter_or_receiver_switch(BT_RECEIVER_EN);
|
||||
}
|
||||
}
|
||||
return MODE_AUX_LP;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
extern void eff_file_switch(u8 *path);
|
||||
|
||||
void kt_eq_sw_bt(void)
|
||||
{
|
||||
printf("--------> kt_eq_sw_bt \n");
|
||||
eff_file_switch(EQ_FILE_BT);
|
||||
}
|
||||
|
||||
void kt_eq_sw_lp(void)
|
||||
{
|
||||
printf("--------> kt_eq_sw_lp \n");
|
||||
eff_file_switch(EQ_FILE_LP);
|
||||
}
|
||||
|
||||
u8 eq = 0;
|
||||
u8 kt_key_event_filter_after(int key_event, int key_value)
|
||||
{
|
||||
u8 ret = true;
|
||||
switch (key_event)
|
||||
{
|
||||
//----------------------------
|
||||
case KEY_MSG_VOLUME_CHK:
|
||||
{
|
||||
#if 0
|
||||
u32 va = adc_get_value(CFG_VOLUME_AD_CH);
|
||||
u8 vol = (u8)(va / 1023.0 * app_audio_get_max_volume());
|
||||
u8 temp = app_audio_get_volume(APP_AUDIO_STATE_MUSIC);
|
||||
if (vol != temp)
|
||||
{
|
||||
if (app_get_curr_task() == APP_LINEIN_TASK && __this->mode.curr_mode != MODE_BT_EMITTER)
|
||||
{
|
||||
linein_volume_set(vol);
|
||||
}
|
||||
else
|
||||
{
|
||||
app_audio_set_volume(APP_AUDIO_STATE_MUSIC, vol, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case KEY_MSG_MODE_CHK:
|
||||
{
|
||||
u8 mode = kt_get_mode();
|
||||
if (mode != MODE_ERROR)
|
||||
{
|
||||
|
||||
// printf("1-mode = %d, curr_mode = %d, next_mode = %d\n", mode, __this->mode.curr_mode, __this->mode.next_mode);
|
||||
if (mode != __this->mode.curr_mode)
|
||||
{
|
||||
// printf("2-mode = %d, curr_mode = %d, next_mode = %d\n", mode, __this->mode.curr_mode, __this->mode.next_mode);
|
||||
if (__this->mode.next_mode == mode)
|
||||
{
|
||||
// printf("3-mode = %d, curr_mode = %d, next_mode = %d\n", mode, __this->mode.curr_mode, __this->mode.next_mode);
|
||||
__this->mode.cnt++;
|
||||
if (__this->mode.cnt > 3)
|
||||
{
|
||||
// printf("4-mode = %d, curr_mode = %d, next_mode = %d\n", mode, __this->mode.curr_mode, __this->mode.next_mode);
|
||||
__this->mode.cnt = 0;
|
||||
__this->mode.curr_mode = kt_mode_change(mode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("5-mode = %d, curr_mode = %d, next_mode = %d\n", mode, __this->mode.curr_mode, __this->mode.next_mode);
|
||||
__this->mode.cnt = 0;
|
||||
__this->mode.next_mode = mode;
|
||||
}
|
||||
}
|
||||
// printf("6-mode = %d, curr_mode = %d, next_mode = %d\n", mode, __this->mode.curr_mode, __this->mode.next_mode);
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* case KEY_MSG_EQ_TEST_CHANGE:
|
||||
{
|
||||
if (eq == 0)
|
||||
{
|
||||
eq = 1;
|
||||
kt_eq_sw_lp();
|
||||
}
|
||||
else
|
||||
{
|
||||
eq = 0;
|
||||
kt_eq_sw_bt();
|
||||
}
|
||||
ret = true;
|
||||
}
|
||||
break; */
|
||||
/*case KEY_MSG_VOLUME_CHANGE:
|
||||
{
|
||||
if (key_value > 1023)
|
||||
{
|
||||
key_value = 1023;
|
||||
}
|
||||
else if (key_value < 0)
|
||||
{
|
||||
key_value = 0;
|
||||
}
|
||||
u8 vol = (u8)(key_value / 1023.0 * app_audio_get_max_volume());
|
||||
u8 temp = app_audio_get_volume(APP_AUDIO_STATE_MUSIC);
|
||||
if (vol != temp)
|
||||
{
|
||||
if (app_get_curr_task() == APP_LINEIN_TASK)
|
||||
{
|
||||
linein_volume_set(vol);
|
||||
}
|
||||
else
|
||||
{
|
||||
app_audio_set_volume(APP_AUDIO_STATE_MUSIC, vol, 1);
|
||||
}
|
||||
}
|
||||
ret = true;
|
||||
}
|
||||
break;*/
|
||||
case KEY_MSG_MODE_CHANGE:
|
||||
{
|
||||
if (__this->mode.curr_mode != __this->mode.next_mode)
|
||||
{
|
||||
u8 mode = kt_get_mode();
|
||||
if (mode == __this->mode.next_mode)
|
||||
{
|
||||
__this->mode.curr_mode = kt_mode_change(mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
__this->mode.next_mode = mode;
|
||||
__this->mode.cnt = 0;
|
||||
}
|
||||
}
|
||||
__this->mode.cnt = 0;
|
||||
ret = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
55
apps/kaotings/kt.h
Normal file
55
apps/kaotings/kt.h
Normal file
@ -0,0 +1,55 @@
|
||||
#ifndef __KT_H__
|
||||
#define __KT_H__
|
||||
|
||||
#include "system/includes.h"
|
||||
#include "kt_dbg.h"
|
||||
|
||||
//KT_LOG_INFO
|
||||
#define _DBG_LEVEL_ KT_LOG_DEBUG
|
||||
|
||||
#define MODE_AUX_LP 0
|
||||
#define MODE_BT_EMITTER 1
|
||||
#define MODE_BT_RECEIVER 2
|
||||
#define MODE_ERROR 3
|
||||
|
||||
#define CFG_MODE_PIN IO_PORTB_03
|
||||
#define CFG_MODE_AD_CH AD_CH_PB3
|
||||
|
||||
#define CFG_VOLUME_PIN IO_PORTB_10
|
||||
#define CFG_VOLUME_AD_CH AD_CH_PB10
|
||||
|
||||
#define CFG_LP_MOT_PIN IO_PORTB_11
|
||||
#define LP_MOT_ON() (gpio_set_output_value(CFG_LP_MOT_PIN,1))
|
||||
#define LP_MOT_OFF() (gpio_set_output_value(CFG_LP_MOT_PIN,0))
|
||||
|
||||
#define CFG_MUTE_PIN IO_PORTB_05
|
||||
#define PA_MUTE() (gpio_set_output_value(CFG_MUTE_PIN,0))
|
||||
#define PA_UNMUTE() (gpio_set_output_value(CFG_MUTE_PIN,1))
|
||||
|
||||
#define CFG_PA_PWR_PIN IO_PORTB_04
|
||||
#define PA_PWR_ON() (gpio_set_output_value(CFG_PA_PWR_PIN,1))
|
||||
#define PA_PWR_OFF() (gpio_set_output_value(CFG_PA_PWR_PIN,0))
|
||||
|
||||
#define CFG_LED_RED_PIN IO_PORTA_06
|
||||
#define LED_RED_ON() (gpio_set_output_value(CFG_LED_RED_PIN,1))
|
||||
#define LED_RED_OFF() (gpio_set_output_value(CFG_LED_RED_PIN,0))
|
||||
|
||||
#define CFG_LED_BLUE_PIN IO_PORTA_07
|
||||
#define LED_BLUE_ON() (gpio_set_output_value(CFG_LED_BLUE_PIN,1))
|
||||
#define LED_BLUE_OFF() (gpio_set_output_value(CFG_LED_BLUE_PIN,0))
|
||||
|
||||
#define EQ_FILE_BT SDFILE_RES_ROOT_PATH"eq_cfg_h1.bin"
|
||||
#define EQ_FILE_LP SDFILE_RES_ROOT_PATH"eq_cfg_h2.bin"
|
||||
|
||||
void kt_eq_sw_lp(void);
|
||||
void kt_eq_sw_bt(void);
|
||||
|
||||
u8 kt_key_event_filter_after(int key_event,int key_value);
|
||||
|
||||
u8 kt_get_mode(void);
|
||||
void kt_boot_init(void);
|
||||
void kt_init(void);
|
||||
void kt_set_curr_mode(u8 mode);
|
||||
u8 kt_get_curr_mode(void);
|
||||
|
||||
#endif
|
||||
58
apps/kaotings/kt_dbg.c
Normal file
58
apps/kaotings/kt_dbg.c
Normal file
@ -0,0 +1,58 @@
|
||||
#include "kt_dbg.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
static int s_kt_log_level = KT_LOG_INFO;
|
||||
|
||||
void kt_dbg_set_level(int level)
|
||||
{
|
||||
if (level < KT_LOG_VERB) {
|
||||
level = KT_LOG_VERB;
|
||||
}
|
||||
if (level > KT_LOG_ERROR) {
|
||||
level = KT_LOG_ERROR;
|
||||
}
|
||||
s_kt_log_level = level;
|
||||
}
|
||||
|
||||
int kt_dbg_get_level(void)
|
||||
{
|
||||
return s_kt_log_level;
|
||||
}
|
||||
|
||||
void kt_dbg_hexdump(const char *tag, const void *buf, int len)
|
||||
{
|
||||
const unsigned char *p = (const unsigned char *)buf;
|
||||
int i;
|
||||
if (buf == NULL || len <= 0) {
|
||||
return;
|
||||
}
|
||||
if (tag) {
|
||||
printf("[%s] HEXDUMP len=%d\r\n", tag, len);
|
||||
} else {
|
||||
printf("[KT] HEXDUMP len=%d\r\n", len);
|
||||
}
|
||||
for (i = 0; i < len; i++) {
|
||||
printf("%02x%s", p[i], ((i + 1) % 16) ? " " : "\r\n");
|
||||
}
|
||||
if (len % 16) {
|
||||
printf("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
void kt_dbg_printf(int level, const char *tag, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
if (level < s_kt_log_level) {
|
||||
return;
|
||||
}
|
||||
if (tag) {
|
||||
printf("[%s] ", tag);
|
||||
} else {
|
||||
printf("[KT] ");
|
||||
}
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
printf("\r\n");
|
||||
}
|
||||
35
apps/kaotings/kt_dbg.h
Normal file
35
apps/kaotings/kt_dbg.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef __KT_DBG_H__
|
||||
#define __KT_DBG_H__
|
||||
|
||||
#include "system/includes.h"
|
||||
/*
|
||||
* 轻量调试封装:直接对接 printf
|
||||
* - 支持简单级别过滤
|
||||
* - 可选 tag 打印
|
||||
*/
|
||||
|
||||
enum {
|
||||
KT_LOG_VERB = 0,
|
||||
KT_LOG_DEBUG = 1,
|
||||
KT_LOG_INFO = 2,
|
||||
KT_LOG_WARN = 3,
|
||||
KT_LOG_ERROR = 4,
|
||||
};
|
||||
|
||||
void kt_dbg_set_level(int level);
|
||||
int kt_dbg_get_level(void);
|
||||
void kt_dbg_hexdump(const char *tag, const void *buf, int len);
|
||||
void kt_dbg_printf(int level, const char *tag, const char *fmt, ...);
|
||||
|
||||
#define KT_LOGV(tag, fmt, ...) \
|
||||
kt_dbg_printf(KT_LOG_VERB, tag, fmt, ## __VA_ARGS__)
|
||||
#define KT_LOGD(tag, fmt, ...) \
|
||||
kt_dbg_printf(KT_LOG_DEBUG, tag, fmt, ## __VA_ARGS__)
|
||||
#define KT_LOGI(tag, fmt, ...) \
|
||||
kt_dbg_printf(KT_LOG_INFO, tag, fmt, ## __VA_ARGS__)
|
||||
#define KT_LOGW(tag, fmt, ...) \
|
||||
kt_dbg_printf(KT_LOG_WARN, tag, fmt, ## __VA_ARGS__)
|
||||
#define KT_LOGE(tag, fmt, ...) \
|
||||
kt_dbg_printf(KT_LOG_ERROR, tag, fmt, ## __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
@ -774,7 +774,7 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
#define TCFG_LINEIN_ENABLE TCFG_APP_LINEIN_EN // linein使能
|
||||
// #define TCFG_LINEIN_LADC_IDX 0 // linein使用的ladc通道,对应ladc_list
|
||||
#define TCFG_LINEIN_LR_CH AUDIO_LIN2_LR
|
||||
#define TCFG_LINEIN_LR_CH AUDIO_LIN0_LR
|
||||
#define TCFG_LINEIN_CHECK_PORT NO_CONFIG_PORT // linein检测IO
|
||||
#define TCFG_LINEIN_PORT_UP_ENABLE 1 // 检测IO上拉使能
|
||||
#define TCFG_LINEIN_PORT_DOWN_ENABLE 0 // 检测IO下拉使能
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef CONFIG_BOARD_AC695X_DEMO_CFG_H
|
||||
#define CONFIG_BOARD_AC695X_DEMO_CFG_H
|
||||
|
||||
#define CONFIG_BOARD_AC695X_DEMO
|
||||
#ifdef CONFIG_BOARD_AC695X_DEMO
|
||||
|
||||
#define CONFIG_SDFILE_ENABLE
|
||||
@ -28,8 +29,8 @@
|
||||
#define TCFG_APP_BT_EN 1
|
||||
#define TCFG_APP_MUSIC_EN 1
|
||||
#define TCFG_APP_LINEIN_EN 1
|
||||
#define TCFG_APP_FM_EN 1
|
||||
#define TCFG_APP_PC_EN 1
|
||||
#define TCFG_APP_FM_EN 0
|
||||
#define TCFG_APP_PC_EN 0
|
||||
#define TCFG_APP_RTC_EN 0
|
||||
#define TCFG_APP_RECORD_EN 0
|
||||
#define TCFG_APP_SPDIF_EN 0
|
||||
@ -44,7 +45,7 @@
|
||||
//*********************************************************************************//
|
||||
#define TCFG_UART0_ENABLE ENABLE_THIS_MOUDLE //串口打印模块使能
|
||||
#define TCFG_UART0_RX_PORT NO_CONFIG_PORT //串口接收脚配置(用于打印可以选择NO_CONFIG_PORT)
|
||||
#define TCFG_UART0_TX_PORT IO_PORTA_05 //串口发送脚配置
|
||||
#define TCFG_UART0_TX_PORT IO_PORT_DP //串口发送脚配置
|
||||
#define TCFG_UART0_BAUDRATE 1000000 //串口波特率配置
|
||||
|
||||
//*********************************************************************************//
|
||||
@ -65,7 +66,7 @@
|
||||
//*********************************************************************************//
|
||||
// 硬件SPI 配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_HW_SPI1_ENABLE ENABLE_THIS_MOUDLE
|
||||
#define TCFG_HW_SPI1_ENABLE DISABLE_THIS_MOUDLE
|
||||
//A组IO: DI: PB2 DO: PB1 CLK: PB0
|
||||
//B组IO: DI: PC3 DO: PC5 CLK: PC4
|
||||
#define TCFG_HW_SPI1_PORT 'A'
|
||||
@ -73,7 +74,7 @@
|
||||
#define TCFG_HW_SPI1_MODE SPI_MODE_BIDIR_1BIT
|
||||
#define TCFG_HW_SPI1_ROLE SPI_ROLE_MASTER
|
||||
|
||||
#define TCFG_HW_SPI2_ENABLE ENABLE_THIS_MOUDLE
|
||||
#define TCFG_HW_SPI2_ENABLE DISABLE_THIS_MOUDLE
|
||||
//A组IO: DI: PB8 DO: PB10 CLK: PB9
|
||||
//B组IO: DI: PA13 DO: DM CLK: DP
|
||||
#define TCFG_HW_SPI2_PORT 'A'
|
||||
@ -118,7 +119,7 @@
|
||||
#define SD_CMD_DECT 0
|
||||
#define SD_CLK_DECT 1
|
||||
#define SD_IO_DECT 2
|
||||
#define TCFG_SD0_ENABLE ENABLE_THIS_MOUDLE
|
||||
#define TCFG_SD0_ENABLE DISABLE_THIS_MOUDLE
|
||||
//A组IO: CMD:PA9 CLK:PA10 DAT0:PA5 DAT1:PA6 DAT2:PA7 DAT3:PA8
|
||||
//B组IO: CMD:PB10 CLK:PB9 DAT0:PB8 DAT1:PB6 DAT2:PB5 DAT3:PB4
|
||||
#define TCFG_SD0_PORTS 'B'
|
||||
@ -142,7 +143,7 @@
|
||||
// USB 配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_PC_ENABLE TCFG_APP_PC_EN//PC模块使能
|
||||
#define TCFG_UDISK_ENABLE ENABLE_THIS_MOUDLE//U盘模块使能
|
||||
#define TCFG_UDISK_ENABLE DISABLE_THIS_MOUDLE//U盘模块使能
|
||||
#define TCFG_OTG_USB_DEV_EN BIT(0)//USB0 = BIT(0) USB1 = BIT(1)
|
||||
|
||||
#define TCFG_VIR_UDISK_ENABLE 0//ENABLE_THIS_MOUDLE
|
||||
@ -211,26 +212,25 @@
|
||||
//*********************************************************************************//
|
||||
// iokey 配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_IOKEY_ENABLE DISABLE_THIS_MOUDLE //是否使能IO按键
|
||||
#define TCFG_IOKEY_ENABLE ENABLE_THIS_MOUDLE //是否使能IO按键
|
||||
|
||||
#define TCFG_IOKEY_POWER_CONNECT_WAY ONE_PORT_TO_LOW //按键一端接低电平一端接IO
|
||||
|
||||
#define TCFG_IOKEY_POWER_ONE_PORT IO_PORTB_01 //IO按键端口
|
||||
#define TCFG_IOKEY_POWER_ONE_PORT IO_PORTB_09 //IO按键端口
|
||||
|
||||
#define TCFG_IOKEY_PREV_CONNECT_WAY ONE_PORT_TO_LOW //按键一端接低电平一端接IO
|
||||
#define TCFG_IOKEY_PREV_ONE_PORT IO_PORTB_00
|
||||
#define TCFG_IOKEY_PREV_ONE_PORT -1
|
||||
|
||||
#define TCFG_IOKEY_NEXT_CONNECT_WAY ONE_PORT_TO_LOW //按键一端接低电平一端接IO
|
||||
#define TCFG_IOKEY_NEXT_ONE_PORT IO_PORTB_02
|
||||
#define TCFG_IOKEY_NEXT_ONE_PORT -1
|
||||
|
||||
//*********************************************************************************//
|
||||
// adkey 配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_ADKEY_ENABLE ENABLE_THIS_MOUDLE//是否使能AD按键
|
||||
#define TCFG_ADKEY_LED_IO_REUSE DISABLE_THIS_MOUDLE //ADKEY 和 LED IO复用,led只能设置蓝灯显示
|
||||
#define TCFG_ADKEY_PORT IO_PORTA_10 //AD按键端口(需要注意选择的IO口是否支持AD功能)
|
||||
#define TCFG_ADKEY_AD_CHANNEL AD_CH_PA10
|
||||
#define TCFG_ADKEY_EXTERN_UP_ENABLE ENABLE_THIS_MOUDLE //是否使用外部上拉
|
||||
#define TCFG_ADKEY_PORT IO_PORTB_01 //AD按键端口(需要注意选择的IO口是否支持AD功能)
|
||||
#define TCFG_ADKEY_AD_CHANNEL AD_CH_PB1
|
||||
#define TCFG_ADKEY_EXTERN_UP_ENABLE DISABLE_THIS_MOUDLE //是否使用外部上拉
|
||||
|
||||
#if TCFG_ADKEY_EXTERN_UP_ENABLE
|
||||
#define R_UP 220 //22K,外部上拉阻值在此自行设置
|
||||
@ -240,15 +240,15 @@
|
||||
|
||||
//必须从小到大填电阻,没有则同VDDIO,填0x3ffL
|
||||
#define TCFG_ADKEY_AD0 (0) //0R
|
||||
#define TCFG_ADKEY_AD1 (0x3ffL * 30 / (30 + R_UP)) //3k
|
||||
#define TCFG_ADKEY_AD2 (0x3ffL * 62 / (62 + R_UP)) //6.2k
|
||||
#define TCFG_ADKEY_AD3 (0x3ffL * 91 / (91 + R_UP)) //9.1k
|
||||
#define TCFG_ADKEY_AD4 (0x3ffL * 150 / (150 + R_UP)) //15k
|
||||
#define TCFG_ADKEY_AD5 (0x3ffL * 240 / (240 + R_UP)) //24k
|
||||
#define TCFG_ADKEY_AD6 (0x3ffL * 330 / (330 + R_UP)) //33k
|
||||
#define TCFG_ADKEY_AD7 (0x3ffL * 510 / (510 + R_UP)) //51k
|
||||
#define TCFG_ADKEY_AD8 (0x3ffL * 1000 / (1000 + R_UP)) //100k
|
||||
#define TCFG_ADKEY_AD9 (0x3ffL * 2200 / (2200 + R_UP)) //220k
|
||||
#define TCFG_ADKEY_AD1 (0x3ffL * 43 / (43 + R_UP)) //3k
|
||||
#define TCFG_ADKEY_AD2 (0x3ffL * 100 / (100 + R_UP)) //6.2k
|
||||
#define TCFG_ADKEY_AD3 (0x3ffL * 220 / (220 + R_UP)) //9.1k
|
||||
#define TCFG_ADKEY_AD4 (0x3ffL) //15k
|
||||
#define TCFG_ADKEY_AD5 (0x3ffL) //24k
|
||||
#define TCFG_ADKEY_AD6 (0x3ffL) //33k
|
||||
#define TCFG_ADKEY_AD7 (0x3ffL) //51k
|
||||
#define TCFG_ADKEY_AD8 (0x3ffL) //100k
|
||||
#define TCFG_ADKEY_AD9 (0x3ffL) //220k
|
||||
#define TCFG_ADKEY_VDDIO (0x3ffL)
|
||||
|
||||
#define TCFG_ADKEY_VOLTAGE0 ((TCFG_ADKEY_AD0 + TCFG_ADKEY_AD1) / 2)
|
||||
@ -392,11 +392,11 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#define AUDIO_OUTPUT_WAY_BT 5 // bt emitter
|
||||
#define AUDIO_OUTPUT_WAY_DAC_IIS 6
|
||||
#define AUDIO_OUTPUT_WAY_DONGLE 7
|
||||
#define AUDIO_OUTPUT_WAY AUDIO_OUTPUT_WAY_DAC
|
||||
#define AUDIO_OUTPUT_WAY AUDIO_OUTPUT_WAY_BT
|
||||
#define LINEIN_INPUT_WAY LINEIN_INPUT_WAY_ADC //LINEIN_INPUT_WAY_ANALOG
|
||||
|
||||
#define AUDIO_OUTPUT_AUTOMUTE 0//ENABLE
|
||||
#define DAC_AUTO_HIGH_Z_EN DISABLE //处理直推串音问题, 隔直不要开
|
||||
#define AUDIO_OUTPUT_AUTOMUTE 1//ENABLE
|
||||
#define DAC_AUTO_HIGH_Z_EN 1 //处理直推串音问题, 隔直不要开
|
||||
|
||||
/*
|
||||
*系统音量类型选择
|
||||
@ -470,9 +470,9 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
// UI 配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_UI_ENABLE 0//ENABLE_THIS_MOUDLE //UI总开关
|
||||
#define CONFIG_UI_STYLE STYLE_JL_LED7
|
||||
#define TCFG_UI_LED7_ENABLE 0//ENABLE_THIS_MOUDLE //UI使用LED7显示
|
||||
#define TCFG_UI_ENABLE DISABLE_THIS_MOUDLE//ENABLE_THIS_MOUDLE //UI总开关
|
||||
//#define CONFIG_UI_STYLE STYLE_JL_LED7
|
||||
#define TCFG_UI_LED7_ENABLE DISABLE_THIS_MOUDLE//ENABLE_THIS_MOUDLE //UI使用LED7显示
|
||||
// #define TCFG_UI_LCD_SEG3X9_ENABLE ENABLE_THIS_MOUDLE //UI使用LCD段码屏显示
|
||||
// #define TCFG_LCD_ST7735S_ENABLE ENABLE_THIS_MOUDLE
|
||||
// #define TCFG_LCD_ST7789VW_ENABLE ENABLE_THIS_MOUDLE
|
||||
@ -505,25 +505,26 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
// EQ配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_EQ_ENABLE 1 //支持EQ功能,EQ总使能
|
||||
#define TCFG_EQ_ENABLE 0 //支持EQ功能,EQ总使能
|
||||
#if TCFG_EQ_ENABLE
|
||||
#define TCFG_BT_MUSIC_EQ_ENABLE 1 //支持蓝牙音乐EQ
|
||||
#define TCFG_PHONE_EQ_ENABLE 1 //支持通话近端EQ
|
||||
#define TCFG_PHONE_EQ_ENABLE 0 //支持通话近端EQ
|
||||
#define TCFG_MUSIC_MODE_EQ_ENABLE 1 //支持音乐模式EQ
|
||||
#define TCFG_LINEIN_MODE_EQ_ENABLE 1 //支持linein近端EQ
|
||||
#define TCFG_FM_MODE_EQ_ENABLE 1 //支持fm模式EQ
|
||||
#define TCFG_SPDIF_MODE_EQ_ENABLE 1 //支持SPDIF模式EQ
|
||||
#define TCFG_PC_MODE_EQ_ENABLE 1 //支持pc模式EQ
|
||||
#define TCFG_FM_MODE_EQ_ENABLE 0 //支持fm模式EQ
|
||||
#define TCFG_SPDIF_MODE_EQ_ENABLE 0 //支持SPDIF模式EQ
|
||||
#define TCFG_PC_MODE_EQ_ENABLE 0 //支持pc模式EQ
|
||||
#define TCFG_AUDIO_OUT_EQ_ENABLE 0 //高低音EQ
|
||||
#define TCFG_AUDIO_MIC_EFFECT_POST_EQ_ENABLE 0 //MIC音效后置EQ使能(includes DRC)
|
||||
|
||||
#define TCFG_USE_EQ_FILE 1
|
||||
|
||||
#define EQ_SECTION_MAX 20//eq 段数
|
||||
#define EQ_SECTION_MAX 10//eq 段数
|
||||
#define TCFG_DYNAMIC_EQ_ENABLE 0 //动态eq使能,接在eq后,需输入32bit位宽数据
|
||||
#endif//TCFG_EQ_ENABLE
|
||||
|
||||
#define TCFG_DRC_ENABLE 1 //DRC 总使能
|
||||
#define TCFG_AUDIO_MDRC_ENABLE 0 //多带drc使能 0:关闭多带drc, 1:使能多带drc 2:使能多带drc 并且 多带drc后再做一次全带的drc
|
||||
#define TCFG_DRC_ENABLE 0 //DRC 总使能
|
||||
#define TCFG_AUDIO_MDRC_ENABLE 1 //多带drc使能 0:关闭多带drc, 1:使能多带drc 2:使能多带drc 并且 多带drc后再做一次全带的drc
|
||||
|
||||
#if TCFG_DRC_ENABLE
|
||||
#define TCFG_BT_MUSIC_DRC_ENABLE 1 //支持蓝牙音乐DRC
|
||||
@ -661,7 +662,7 @@ DAC硬件上的连接方式,可选的配置:
|
||||
// 系统配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_AUTO_SHUT_DOWN_TIME 0 //没有蓝牙连接自动关机时间
|
||||
#define TCFG_SYS_LVD_EN 1 //电量检测使能
|
||||
#define TCFG_SYS_LVD_EN 0 //电量检测使能
|
||||
#define TCFG_POWER_ON_NEED_KEY 0 //是否需要按按键开机配置
|
||||
#define TWFG_APP_POWERON_IGNORE_DEV 4000//上电忽略挂载设备,0时不忽略,非0则n毫秒忽略
|
||||
|
||||
@ -674,11 +675,11 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#define TCFG_USER_BLE_ENABLE 0 //BLE功能使能
|
||||
#define TCFG_USER_BT_CLASSIC_ENABLE 1 //经典蓝牙功能使能
|
||||
#define TCFG_BT_SUPPORT_AAC 0 //AAC格式支持
|
||||
#define TCFG_USER_EMITTER_ENABLE 0 //emitter功能使能
|
||||
#define TCFG_USER_EMITTER_ENABLE 1 //emitter功能使能
|
||||
#define TCFG_BT_SNIFF_ENABLE 0 //bt sniff 功能使能
|
||||
|
||||
#define USER_SUPPORT_PROFILE_SPP 1
|
||||
#define USER_SUPPORT_PROFILE_HFP 1
|
||||
#define USER_SUPPORT_PROFILE_SPP 0
|
||||
#define USER_SUPPORT_PROFILE_HFP 0
|
||||
#define USER_SUPPORT_PROFILE_A2DP 1
|
||||
#define USER_SUPPORT_PROFILE_AVCTP 1
|
||||
#define USER_SUPPORT_PROFILE_HID 1
|
||||
@ -698,10 +699,10 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#endif
|
||||
|
||||
#define BT_INBAND_RINGTONE 0 //是否播放手机自带来电铃声
|
||||
#define BT_PHONE_NUMBER 1 //是否播放来电报号
|
||||
#define BT_PHONE_NUMBER 0 //是否播放来电报号
|
||||
#define BT_SYNC_PHONE_RING 0 //是否TWS同步播放来电铃声
|
||||
#define BT_SUPPORT_DISPLAY_BAT 1 //是否使能电量检测
|
||||
#define BT_SUPPORT_MUSIC_VOL_SYNC 1 //是否使能音量同步
|
||||
#define BT_SUPPORT_DISPLAY_BAT 0 //是否使能电量检测
|
||||
#define BT_SUPPORT_MUSIC_VOL_SYNC 0 //是否使能音量同步
|
||||
|
||||
#define TCFG_BLUETOOTH_BACK_MODE 1 //后台模式
|
||||
|
||||
@ -743,7 +744,7 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#define TCFG_LINEIN_ENABLE TCFG_APP_LINEIN_EN // linein使能
|
||||
// #define TCFG_LINEIN_LADC_IDX 0 // linein使用的ladc通道,对应ladc_list
|
||||
#define TCFG_LINEIN_LR_CH AUDIO_LIN0_LR
|
||||
#define TCFG_LINEIN_CHECK_PORT IO_PORTB_03 // linein检测IO
|
||||
#define TCFG_LINEIN_CHECK_PORT -1 // linein检测IO
|
||||
#define TCFG_LINEIN_PORT_UP_ENABLE 1 // 检测IO上拉使能
|
||||
#define TCFG_LINEIN_PORT_DOWN_ENABLE 0 // 检测IO下拉使能
|
||||
#define TCFG_LINEIN_AD_CHANNEL NO_CONFIG_PORT // 检测IO是否使用AD检测
|
||||
@ -838,13 +839,13 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#if (AUDIO_OUTPUT_WAY == AUDIO_OUTPUT_WAY_IIS) || (AUDIO_OUTPUT_WAY == AUDIO_OUTPUT_WAY_DAC_IIS)
|
||||
#define TCFG_IIS_ENABLE ENABLE_THIS_MOUDLE
|
||||
#else
|
||||
#define TCFG_IIS_ENABLE DISABLE_THIS_MOUDLE
|
||||
#define TCFG_IIS_ENABLE ENABLE_THIS_MOUDLE
|
||||
#endif
|
||||
|
||||
#define TCFG_IIS_MODE (0) // 0:master 1:slave
|
||||
|
||||
#define TCFG_IIS_OUTPUT_EN (ENABLE && TCFG_IIS_ENABLE)
|
||||
#define TCFG_IIS_OUTPUT_PORT ALINK0_PORTA
|
||||
#define TCFG_IIS_OUTPUT_PORT ALINK1_PORTA
|
||||
#define TCFG_IIS_OUTPUT_CH_NUM 1 //0:mono,1:stereo
|
||||
#define TCFG_IIS_OUTPUT_SR 44100
|
||||
#define TCFG_IIS_OUTPUT_DATAPORT_SEL 0
|
||||
|
||||
@ -5,12 +5,12 @@
|
||||
* 板级配置选择
|
||||
*/
|
||||
|
||||
// #define CONFIG_BOARD_AC695X_DEMO
|
||||
#define CONFIG_BOARD_AC695X_DEMO
|
||||
// #define CONFIG_BOARD_AC6951_KGB_V1
|
||||
// #define CONFIG_BOARD_AC6955F_HEADSET_MONO
|
||||
// #define CONFIG_BOARD_AC6952E_LIGHTER
|
||||
// #define CONFIG_BOARD_AC695X_CHARGING_BIN
|
||||
#define CONFIG_BOARD_AC695X_BTEMITTER
|
||||
// #define CONFIG_BOARD_AC695X_BTEMITTER
|
||||
// #define CONFIG_BOARD_AC695X_TWS_BOX
|
||||
// #define CONFIG_BOARD_AC695X_TWS
|
||||
// #define CONFIG_BOARD_AC695X_MULTIMEDIA_CHARGING_BIN
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
#include "app_charge.h"
|
||||
#include "chgbox_ctrl.h"
|
||||
#include "update_loader_download.h"
|
||||
#include "kt.h"
|
||||
|
||||
|
||||
extern void setup_arch();
|
||||
@ -103,6 +104,8 @@ static void app_init()
|
||||
|
||||
board_init();
|
||||
|
||||
kt_boot_init();
|
||||
|
||||
do_initcall();
|
||||
|
||||
do_module_initcall();
|
||||
|
||||
@ -173,6 +173,11 @@ enum {
|
||||
KEY_IR_NUM_8,
|
||||
KEY_IR_NUM_9,//中间不允许插入
|
||||
//在这里增加元素
|
||||
KEY_MSG_MODE_CHANGE,
|
||||
KEY_MSG_VOLUME_CHANGE,
|
||||
KEY_MSG_EQ_TEST_CHANGE,
|
||||
KEY_MSG_VOLUME_CHK,
|
||||
KEY_MSG_MODE_CHK,
|
||||
//
|
||||
KEY_HCI_DISCONNECT_CLEAR_VM,
|
||||
KEY_CALL_RECEIVER,
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
#if(TCFG_UI_ENABLE && TCFG_SPI_LCD_ENABLE)//点阵屏断开蓝牙连接时可选择不跳回蓝牙模式
|
||||
#define BACKGROUND_GOBACK 0 //后台链接是否跳回蓝牙 1:跳回
|
||||
#else
|
||||
#define BACKGROUND_GOBACK 1
|
||||
#define BACKGROUND_GOBACK 0
|
||||
#endif
|
||||
|
||||
#define TIMEOUT_CONN_TIME 60 //超时断开之后回连的时间s
|
||||
|
||||
@ -96,6 +96,8 @@
|
||||
#include "tuya_multi/tuya_le_multi_common.h"
|
||||
#include "multi_demo/le_multi_common.h"
|
||||
|
||||
#include "kt.h"
|
||||
|
||||
|
||||
#define LOG_TAG_CONST BT
|
||||
#define LOG_TAG "[BT]"
|
||||
@ -616,8 +618,9 @@ void bt_function_select_init()
|
||||
////设置蓝牙加密的level
|
||||
//io_capabilities ; /*0: Display only 1: Display YesNo 2: KeyboardOnly 3: NoInputNoOutput*/
|
||||
//authentication_requirements: 0:not protect 1 :protect
|
||||
|
||||
__set_simple_pair_param(3, 0, 2);//__set_simple_pair_param(3, 0, 2);
|
||||
//flym 20251014 20:12:00
|
||||
// 修改为Just Works配对模式,避免配对码出现
|
||||
__set_simple_pair_param(3, 0, 0);//__set_simple_pair_param(3, 0, 2);
|
||||
|
||||
#if (USER_SUPPORT_PROFILE_PBAP==1)
|
||||
////设置蓝牙设备类型
|
||||
@ -809,9 +812,20 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
break;
|
||||
case BT_STATUS_RECONN_OR_CONN:
|
||||
log_info(" BT_STATUS_RECONN_OR_CONN \n");
|
||||
if (kt_get_mode() == MODE_BT_EMITTER)
|
||||
{
|
||||
emitter_or_receiver_switch(BT_EMITTER_EN);
|
||||
app_task_switch_to(APP_LINEIN_TASK);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log_info(" BT STATUS DEFAULT\n");
|
||||
//printf("user_role : %d conn_total : %d bt_role : %d \n", kt_get_user_role(), get_total_connect_dev(), bt_emitter_role_get());
|
||||
if (kt_get_user_role() == MODE_BT_EMITTER && get_total_connect_dev() == 0)
|
||||
{
|
||||
printf("[EMITTER][SEARCH_STOP][%s-%d] no device found, restart search\n",__func__,__LINE__);
|
||||
bt_emitter_start_search_device();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@ -847,6 +861,7 @@ static int bt_hci_event_handler(struct bt_event *bt)
|
||||
case HCI_EVENT_IO_CAPABILITY_REQUEST:
|
||||
log_info(" HCI_EVENT_IO_CAPABILITY_REQUEST \n");
|
||||
clock_add_set(BT_CONN_CLK);
|
||||
// IO Capability请求由底层自动处理,这里只需要添加时钟
|
||||
break;
|
||||
case HCI_EVENT_USER_CONFIRMATION_REQUEST:
|
||||
log_info(" HCI_EVENT_USER_CONFIRMATION_REQUEST %d \n", bt->value);
|
||||
@ -886,6 +901,12 @@ static int bt_hci_event_handler(struct bt_event *bt)
|
||||
case ERROR_CODE_PIN_OR_KEY_MISSING:
|
||||
log_info(" ERROR_CODE_PIN_OR_KEY_MISSING \n");
|
||||
bt_hci_event_linkkey_missing(bt);
|
||||
do {
|
||||
u8 is_emitter = (bt_emitter_role_get() == BT_EMITTER_EN);
|
||||
u16 ch = is_emitter ? get_emitter_curr_channel_state() : get_curr_channel_state();
|
||||
printf("[RECONNECT][FAIL][%s] reason:0x%02x ch:0x%04x file:%s line:%d\n",
|
||||
is_emitter ? "EMITTER" : "RECEIVER", bt->value, ch, __FILE__, __LINE__);
|
||||
} while (0);
|
||||
case ERROR_CODE_SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED :
|
||||
case ERROR_CODE_CONNECTION_REJECTED_DUE_TO_LIMITED_RESOURCES:
|
||||
case ERROR_CODE_CONNECTION_REJECTED_DUE_TO_UNACCEPTABLE_BD_ADDR:
|
||||
@ -894,15 +915,48 @@ static int bt_hci_event_handler(struct bt_event *bt)
|
||||
case ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST :
|
||||
case ERROR_CODE_AUTHENTICATION_FAILURE :
|
||||
case CUSTOM_BB_AUTO_CANCEL_PAGE:
|
||||
do {
|
||||
u8 is_emitter = (bt_emitter_role_get() == BT_EMITTER_EN);
|
||||
u16 ch = is_emitter ? get_emitter_curr_channel_state() : get_curr_channel_state();
|
||||
printf("[RECONNECT][FAIL][%s] reason:0x%02x ch:0x%04x file:%s line:%d\n",
|
||||
is_emitter ? "EMITTER" : "RECEIVER", bt->value, ch, __FILE__, __LINE__);
|
||||
} while (0);
|
||||
bt_hci_event_disconnect(bt) ;
|
||||
if(bt_emitter_role_get() == BT_EMITTER_EN && get_total_connect_dev() == 0)
|
||||
{
|
||||
printf("EMITTER][VM] reconnect failed, start search\n");
|
||||
bt_emitter_start_search_device();
|
||||
}
|
||||
break;
|
||||
case ERROR_CODE_PAGE_TIMEOUT:
|
||||
log_info(" ERROR_CODE_PAGE_TIMEOUT \n");
|
||||
do {
|
||||
u8 is_emitter = (bt_emitter_role_get() == BT_EMITTER_EN);
|
||||
u16 ch = is_emitter ? get_emitter_curr_channel_state() : get_curr_channel_state();
|
||||
printf("[RECONNECT][FAIL][%s] reason:0x%02x ch:0x%04x file:%s line:%d\n",
|
||||
is_emitter ? "EMITTER" : "RECEIVER", bt->value, ch, __FILE__, __LINE__);
|
||||
} while (0);
|
||||
bt_hci_event_page_timeout(bt);
|
||||
if(bt_emitter_role_get() == BT_EMITTER_EN && get_total_connect_dev() == 0)
|
||||
{
|
||||
printf("EMITTER][VM] reconnect failed, start search\n");
|
||||
bt_emitter_start_search_device();
|
||||
}
|
||||
break;
|
||||
case ERROR_CODE_CONNECTION_TIMEOUT:
|
||||
log_info(" ERROR_CODE_CONNECTION_TIMEOUT \n");
|
||||
do {
|
||||
u8 is_emitter = (bt_emitter_role_get() == BT_EMITTER_EN);
|
||||
u16 ch = is_emitter ? get_emitter_curr_channel_state() : get_curr_channel_state();
|
||||
printf("[RECONNECT][FAIL][%s] reason:0x%02x ch:0x%04x file:%s line:%d\n",
|
||||
is_emitter ? "EMITTER" : "RECEIVER", bt->value, ch, __FILE__, __LINE__);
|
||||
} while (0);
|
||||
bt_hci_event_connection_timeout(bt);
|
||||
if(bt_emitter_role_get() == BT_EMITTER_EN && get_total_connect_dev() == 0)
|
||||
{
|
||||
printf("EMITTER][VM] reconnect failed, start search\n");
|
||||
bt_emitter_start_search_device();
|
||||
}
|
||||
break;
|
||||
case ERROR_CODE_ACL_CONNECTION_ALREADY_EXISTS :
|
||||
log_info("ERROR_CODE_ACL_CONNECTION_ALREADY_EXISTS \n");
|
||||
@ -1139,12 +1193,18 @@ int bt_key_event_handler(struct sys_event *event)
|
||||
int key_value = event->u.key.value;
|
||||
|
||||
|
||||
log_debug("bt key_event:%d %d %d %d\n", key_event, key->value, key->event, key->init);
|
||||
//log_debug("bt key_event:%d %d %d %d\n", key_event, key->value, key->event, key->init);
|
||||
|
||||
if (bt_key_event_filter_after(key_event) == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (kt_key_event_filter_after(key_event,key_value) == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch (key_event) {
|
||||
case KEY_HCI_DISCONNECT_CLEAR_VM:
|
||||
printf("KEY_HCI_DISCONNECT_CLEAR_VM\n");
|
||||
@ -1378,6 +1438,8 @@ void app_bt_task()
|
||||
int msg[32];
|
||||
ui_update_status(STATUS_EXIT_LOWPOWER);
|
||||
|
||||
//kt_eq_sw_bt();
|
||||
|
||||
bt_task_init();//初始化变量、时钟、显示(未进行协议栈初始化)
|
||||
|
||||
#if TCFG_TONE2TWS_ENABLE
|
||||
@ -1387,8 +1449,9 @@ void app_bt_task()
|
||||
|
||||
extern u8 get_tws_background_connected_flag();
|
||||
if (!__this->cmd_flag && (!get_tws_background_connected_flag())) { //蓝牙后台拉回蓝牙模式不播放提示音
|
||||
tone_play_with_callback_by_name(tone_table[IDEX_TONE_BT_MODE], 1, bt_tone_play_end_callback, (void *)IDEX_TONE_BT_MODE);
|
||||
//tone_play_with_callback_by_name(tone_table[IDEX_TONE_BT_MODE], 1, bt_tone_play_end_callback, (void *)IDEX_TONE_BT_MODE);
|
||||
//协议栈初始化在提示音结束进行
|
||||
bt_task_start();
|
||||
} else {
|
||||
//后台返回的情况没有播放提示音,需要在这里进行协议栈的resume
|
||||
bt_task_start();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -51,6 +51,9 @@
|
||||
#include "dac.h"
|
||||
#include "audio_recorder_mix.h"
|
||||
|
||||
#include "kt.h"
|
||||
|
||||
|
||||
#define LOG_TAG_CONST BT
|
||||
#define LOG_TAG "[BT]"
|
||||
#define LOG_ERROR_ENABLE
|
||||
@ -1104,7 +1107,14 @@ void bt_status_init_ok(struct bt_event *bt)
|
||||
extern u8 emitter_search_result(char *name, u8 name_len, u8 * addr, u32 dev_class, char rssi);
|
||||
inquiry_result_handle_register(emitter_search_result);
|
||||
extern void emitter_or_receiver_switch(u8 flag);
|
||||
emitter_or_receiver_switch(BT_EMITTER_EN);
|
||||
if (kt_get_mode() == MODE_BT_EMITTER)
|
||||
{
|
||||
emitter_or_receiver_switch(BT_EMITTER_EN);
|
||||
}
|
||||
else
|
||||
{
|
||||
emitter_or_receiver_switch(BT_RECEIVER_EN);
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
|
||||
@ -2138,6 +2148,12 @@ void bt_hci_event_connection(struct bt_event *bt)
|
||||
void bt_hci_event_disconnect(struct bt_event *bt)
|
||||
{
|
||||
u8 local_addr[6];
|
||||
do {
|
||||
u8 is_emitter = (bt_emitter_role_get() == BT_EMITTER_EN);
|
||||
u16 ch = is_emitter ? get_emitter_curr_channel_state() : get_curr_channel_state();
|
||||
printf("[RECONNECT][FAIL][%s] reason:0x%02x ch:0x%04x file:%s line:%d\n",
|
||||
is_emitter ? "EMITTER" : "RECEIVER", bt->value, ch, __FILE__, __LINE__);
|
||||
} while (0);
|
||||
if (app_var.goto_poweroff_flag || __this->exiting) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2,18 +2,17 @@
|
||||
/*************************************************************
|
||||
此文件函数主要是linein模式按键处理和事件处理
|
||||
|
||||
void app_linein_task()
|
||||
void app_linein_task()
|
||||
linein模式主函数
|
||||
|
||||
static int linein_sys_event_handler(struct sys_event *event)
|
||||
static int linein_sys_event_handler(struct sys_event *event)
|
||||
linein模式系统事件所有处理入口
|
||||
|
||||
static void linein_task_close(void)
|
||||
linein模式退出
|
||||
static void linein_task_close(void)
|
||||
linein模式退出
|
||||
|
||||
**************************************************************/
|
||||
|
||||
|
||||
#include "system/app_core.h"
|
||||
#include "system/includes.h"
|
||||
#include "server/server_core.h"
|
||||
@ -51,11 +50,12 @@
|
||||
#include "bt.h"
|
||||
#include "bt_tws.h"
|
||||
|
||||
#include "kt.h"
|
||||
|
||||
#if TCFG_APP_LINEIN_EN
|
||||
|
||||
#define LOG_TAG_CONST APP_LINEIN
|
||||
#define LOG_TAG "[APP_LINEIN]"
|
||||
#define LOG_TAG_CONST APP_LINEIN
|
||||
#define LOG_TAG "[APP_LINEIN]"
|
||||
#define LOG_ERROR_ENABLE
|
||||
#define LOG_DEBUG_ENABLE
|
||||
#define LOG_INFO_ENABLE
|
||||
@ -63,8 +63,7 @@
|
||||
#define LOG_CLI_ENABLE
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
static u8 linein_last_onoff = (u8) - 1;
|
||||
static u8 linein_last_onoff = (u8)-1;
|
||||
static u8 linein_bt_back_flag = 0;
|
||||
static u8 linein_idle_flag = 1;
|
||||
|
||||
@ -77,23 +76,27 @@ static u8 linein_idle_flag = 1;
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int linein_device_event_handler(struct sys_event *event)
|
||||
{
|
||||
if ((u32)event->arg == DEVICE_EVENT_FROM_LINEIN) {
|
||||
if (event->u.dev.event == DEVICE_EVENT_IN) {
|
||||
if ((u32)event->arg == DEVICE_EVENT_FROM_LINEIN)
|
||||
{
|
||||
if (event->u.dev.event == DEVICE_EVENT_IN)
|
||||
{
|
||||
log_info("linein online \n");
|
||||
return true;
|
||||
} else if (event->u.dev.event == DEVICE_EVENT_OUT) {
|
||||
}
|
||||
else if (event->u.dev.event == DEVICE_EVENT_OUT)
|
||||
{
|
||||
log_info("linein offline \n");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static int linein_key_event_filter_before()
|
||||
{
|
||||
#if TCFG_UI_ENABLE
|
||||
#if (TCFG_APP_FM_EMITTER_EN == ENABLE_THIS_MOUDLE)
|
||||
if (ui_get_app_menu(GRT_CUR_MENU) == MENU_FM_SET_FRE) {
|
||||
if (ui_get_app_menu(GRT_CUR_MENU) == MENU_FM_SET_FRE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -101,7 +104,6 @@ static int linein_key_event_filter_before()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief linein 按键消息入口
|
||||
@param 无
|
||||
@ -115,47 +117,55 @@ static int linein_key_msg_deal(struct sys_event *event)
|
||||
int err = 0;
|
||||
u8 vol;
|
||||
int key_event = event->u.key.event;
|
||||
int key_value = event->u.key.value;//
|
||||
int key_value = event->u.key.value; //
|
||||
|
||||
if (linein_key_event_filter_before() == false) {
|
||||
if (linein_key_event_filter_before() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
log_info("key_event:%d \n", key_event);
|
||||
//log_info("key_event:%d \n", key_event);
|
||||
#if (SMART_BOX_EN)
|
||||
extern bool smartbox_key_event_filter_before(int key_event);
|
||||
if (smartbox_key_event_filter_before(key_event)) {
|
||||
if (smartbox_key_event_filter_before(key_event))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (key_event) {
|
||||
if (kt_key_event_filter_after(key_event, key_value) == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (key_event)
|
||||
{
|
||||
case KEY_LINEIN_START:
|
||||
linein_start();
|
||||
linein_last_onoff = 1;
|
||||
UI_REFLASH_WINDOW(true);//刷新主页并且支持打断显示
|
||||
UI_REFLASH_WINDOW(true); // 刷新主页并且支持打断显示
|
||||
break;
|
||||
case KEY_TEST_DEMO_0:
|
||||
log_info("KEY_TEST_DEMO_0 = %d \n", key_value);
|
||||
app_task_put_key_msg(KEY_TEST_DEMO_1, 5678); //test demo
|
||||
app_task_put_key_msg(KEY_TEST_DEMO_1, 5678); // test demo
|
||||
break;
|
||||
case KEY_TEST_DEMO_1:
|
||||
log_info("KEY_TEST_DEMO_1 = %d \n", key_value); //test demo
|
||||
log_info("KEY_TEST_DEMO_1 = %d \n", key_value); // test demo
|
||||
break;
|
||||
|
||||
case KEY_MUSIC_PP:
|
||||
case KEY_MUSIC_PP:
|
||||
log_info("KEY_MUSIC_PP\n");
|
||||
/* app_task_put_key_msg(KEY_TEST_DEMO_0,1234); //test demo// */
|
||||
linein_last_onoff = linein_volume_pp();
|
||||
linein_last_onoff ? ui_update_status(STATUS_LINEIN_PLAY)\
|
||||
: ui_update_status(STATUS_LINEIN_PAUSE);
|
||||
linein_last_onoff ? ui_update_status(STATUS_LINEIN_PLAY)
|
||||
: ui_update_status(STATUS_LINEIN_PAUSE);
|
||||
break;
|
||||
case KEY_VOL_UP:
|
||||
case KEY_VOL_UP:
|
||||
log_info(" KEY_VOL_UP\n");
|
||||
linein_key_vol_up();
|
||||
break;
|
||||
|
||||
case KEY_VOL_DOWN:
|
||||
case KEY_VOL_DOWN:
|
||||
log_info(" KEY_VOL_DOWN\n");
|
||||
linein_key_vol_down();
|
||||
break;
|
||||
@ -179,18 +189,20 @@ static int linein_key_msg_deal(struct sys_event *event)
|
||||
@note
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static void line_tone_play_end_callback(void *priv, int flag)
|
||||
static void line_tone_play_end_callback(void *priv, int flag)
|
||||
{
|
||||
u32 index = (u32)priv;
|
||||
|
||||
if (APP_LINEIN_TASK != app_get_curr_task()) {
|
||||
if (APP_LINEIN_TASK != app_get_curr_task())
|
||||
{
|
||||
log_error("tone callback task out \n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (index) {
|
||||
switch (index)
|
||||
{
|
||||
case IDEX_TONE_LINEIN:
|
||||
///提示音播放结束, 启动播放器播放
|
||||
/// 提示音播放结束, 启动播放器播放
|
||||
app_task_put_key_msg(KEY_LINEIN_START, 0);
|
||||
break;
|
||||
default:
|
||||
@ -198,7 +210,6 @@ static void line_tone_play_end_callback(void *priv, int flag)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief linein 入口
|
||||
@param 无
|
||||
@ -209,12 +220,11 @@ static void line_tone_play_end_callback(void *priv, int flag)
|
||||
static void linein_app_init(void)
|
||||
{
|
||||
linein_idle_flag = 0;
|
||||
UI_SHOW_WINDOW(ID_WINDOW_LINEIN);//打开ui主页
|
||||
UI_SHOW_WINDOW(ID_WINDOW_LINEIN); // 打开ui主页
|
||||
UI_SHOW_MENU(MENU_AUX, 0, 0, NULL);
|
||||
sys_key_event_enable();//开启按键
|
||||
sys_key_event_enable(); // 开启按键
|
||||
ui_update_status(STATUS_LINEIN_MODE);
|
||||
clock_idle(LINEIN_IDLE_CLOCK);
|
||||
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
@ -234,7 +244,6 @@ static void linein_task_close(void)
|
||||
linein_idle_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief linein 模式活跃状态 所有消息入口
|
||||
@param 无
|
||||
@ -245,15 +254,20 @@ static void linein_task_close(void)
|
||||
static int linein_sys_event_handler(struct sys_event *event)
|
||||
{
|
||||
int ret = TRUE;
|
||||
switch (event->type) {
|
||||
switch (event->type)
|
||||
{
|
||||
case SYS_KEY_EVENT:
|
||||
return linein_key_msg_deal(event);
|
||||
break;
|
||||
case SYS_DEVICE_EVENT:
|
||||
if ((u32)event->arg == DEVICE_EVENT_FROM_LINEIN) {
|
||||
if (event->u.dev.event == DEVICE_EVENT_IN) {
|
||||
if ((u32)event->arg == DEVICE_EVENT_FROM_LINEIN)
|
||||
{
|
||||
if (event->u.dev.event == DEVICE_EVENT_IN)
|
||||
{
|
||||
log_info("linein online \n");
|
||||
} else if (event->u.dev.event == DEVICE_EVENT_OUT) {
|
||||
}
|
||||
else if (event->u.dev.event == DEVICE_EVENT_OUT)
|
||||
{
|
||||
log_info("linein offline \n");
|
||||
app_task_switch_next();
|
||||
}
|
||||
@ -267,7 +281,6 @@ static int linein_sys_event_handler(struct sys_event *event)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief linein 在线检测 切换模式判断使用
|
||||
@param 无
|
||||
@ -277,7 +290,8 @@ static int linein_sys_event_handler(struct sys_event *event)
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int linein_app_check(void)
|
||||
{
|
||||
if (linein_is_online()) {
|
||||
if (linein_is_online())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -296,48 +310,76 @@ void app_linein_task()
|
||||
int err = 0;
|
||||
int msg[32];
|
||||
|
||||
//kt_eq_sw_lp();
|
||||
|
||||
LP_MOT_ON();
|
||||
|
||||
//printf("curr line mode but get_curr_mode = %d \r\n",kt_get_curr_mode())
|
||||
|
||||
/* if (kt_get_curr_mode() == MODE_BT_EMITTER)
|
||||
{
|
||||
PA_MUTE();
|
||||
}
|
||||
else
|
||||
{
|
||||
PA_UNMUTE();
|
||||
} */
|
||||
|
||||
|
||||
|
||||
#if TCFG_APP_BT_EN
|
||||
linein_bt_back_flag = get_bt_back_flag();//从蓝牙后台返回标志
|
||||
linein_bt_back_flag = get_bt_back_flag(); // 从蓝牙后台返回标志
|
||||
set_bt_back_flag(0);
|
||||
#else
|
||||
linein_bt_back_flag = 0;
|
||||
#endif
|
||||
log_info("linein_bt_back_flag == %d linein_last_onoff = %d\n", \
|
||||
log_info("linein_bt_back_flag == %d linein_last_onoff = %d\n",
|
||||
linein_bt_back_flag, linein_last_onoff);
|
||||
|
||||
linein_app_init();//初始化时钟和开启ui
|
||||
linein_app_init(); // 初始化时钟和开启ui
|
||||
|
||||
#if TCFG_DEC2TWS_ENABLE
|
||||
extern void set_tws_background_connected_flag(u8 flag);
|
||||
extern u8 get_tws_background_connected_flag();
|
||||
if (get_tws_background_connected_flag()) { //不播放提示音
|
||||
if (get_tws_background_connected_flag())
|
||||
{ // 不播放提示音
|
||||
app_task_put_key_msg(KEY_LINEIN_START, 0);
|
||||
set_tws_background_connected_flag(0);
|
||||
} else
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_LINEIN], 1,
|
||||
line_tone_play_end_callback, (void *)IDEX_TONE_LINEIN);
|
||||
// err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_LINEIN], 1,
|
||||
// line_tone_play_end_callback, (void *)IDEX_TONE_LINEIN);
|
||||
}
|
||||
// if (err) { //
|
||||
// ///提示音播放失败,直接推送KEY_MUSIC_PLAYER_START启动播放
|
||||
// app_task_put_key_msg(KEY_LINEIN_START, 0);
|
||||
// }
|
||||
// if (err) { //
|
||||
// ///提示音播放失败,直接推送KEY_MUSIC_PLAYER_START启动播放
|
||||
// app_task_put_key_msg(KEY_LINEIN_START, 0);
|
||||
// }
|
||||
|
||||
while (1) {
|
||||
app_task_put_key_msg(KEY_LINEIN_START, 0);
|
||||
|
||||
PA_UNMUTE();
|
||||
|
||||
while (1)
|
||||
{
|
||||
app_task_get_msg(msg, ARRAY_SIZE(msg), 1);
|
||||
|
||||
switch (msg[0]) {
|
||||
switch (msg[0])
|
||||
{
|
||||
case APP_MSG_SYS_EVENT:
|
||||
if (linein_sys_event_handler((struct sys_event *)(&msg[1])) == false) {
|
||||
app_default_event_deal((struct sys_event *)(&msg[1])); //由common统一处理
|
||||
if (linein_sys_event_handler((struct sys_event *)(&msg[1])) == false)
|
||||
{
|
||||
app_default_event_deal((struct sys_event *)(&msg[1])); // 由common统一处理
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (app_task_exitting()) {
|
||||
if (app_task_exitting())
|
||||
{
|
||||
//LP_MOT_OFF();
|
||||
linein_task_close();
|
||||
return;
|
||||
}
|
||||
@ -362,9 +404,6 @@ int linein_app_check(void)
|
||||
|
||||
void app_linein_task()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -238,12 +238,12 @@ static void poweroff_app_start()
|
||||
} else
|
||||
#endif/*CONFIG_TWS_POWEROFF_SAME_TIME*/
|
||||
{
|
||||
ret = tone_play_with_callback_by_name(tone_table[IDEX_TONE_POWER_OFF], 1,
|
||||
poweroff_tone_end, (void *)IDEX_TONE_POWER_OFF);
|
||||
if (ret) {
|
||||
//ret = tone_play_with_callback_by_name(tone_table[IDEX_TONE_POWER_OFF], 1,
|
||||
// poweroff_tone_end, (void *)IDEX_TONE_POWER_OFF);
|
||||
//if (ret) {
|
||||
y_printf("power_off tone play err,enter soft poweroff");
|
||||
poweroff_done();
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,10 +12,10 @@
|
||||
#include "ui/ui_api.h"
|
||||
#include "app_task.h"
|
||||
#include "key_event_deal.h"
|
||||
#include "kt.h"
|
||||
|
||||
|
||||
#define LOG_TAG_CONST APP_IDLE
|
||||
#define LOG_TAG "[APP_IDLE]"
|
||||
#define LOG_TAG_CONST APP_IDLE
|
||||
#define LOG_TAG "[APP_IDLE]"
|
||||
#define LOG_ERROR_ENABLE
|
||||
#define LOG_DEBUG_ENABLE
|
||||
#define LOG_INFO_ENABLE
|
||||
@ -23,8 +23,7 @@
|
||||
#define LOG_CLI_ENABLE
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
static void lcd_ui_power_on_timeout(void *p)
|
||||
static void lcd_ui_power_on_timeout(void *p)
|
||||
{
|
||||
#if (TCFG_SPI_LCD_ENABLE)
|
||||
/* sys_key_event_enable(); */
|
||||
@ -41,10 +40,9 @@ static void lcd_ui_power_on_timeout(void *p)
|
||||
app_task_switch_to(APP_MUSIC_TASK);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void lcd_ui_power_on()
|
||||
static void lcd_ui_power_on()
|
||||
{
|
||||
#if (TCFG_SPI_LCD_ENABLE)
|
||||
int logo_time = 0;
|
||||
@ -55,17 +53,51 @@ static void lcd_ui_power_on()
|
||||
|
||||
static int power_on_init(void)
|
||||
{
|
||||
///有些需要在开机提示完成之后再初始化的东西, 可以在这里初始化
|
||||
/// 有些需要在开机提示完成之后再初始化的东西, 可以在这里初始化
|
||||
#if (TCFG_SPI_LCD_ENABLE)
|
||||
lcd_ui_power_on();//由ui决定切换的模式
|
||||
lcd_ui_power_on(); // 由ui决定切换的模式
|
||||
return 0;
|
||||
#endif
|
||||
int i = 0;
|
||||
u8 mode = MODE_AUX_LP;
|
||||
while (1)
|
||||
{
|
||||
if (mode == kt_get_mode())
|
||||
{
|
||||
i++;
|
||||
if (i > 3)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = kt_get_mode();
|
||||
i = 0;
|
||||
}
|
||||
clr_wdt();
|
||||
os_time_dly(1);
|
||||
}
|
||||
|
||||
kt_set_curr_mode(mode);
|
||||
printf("----------->>>>>>>>>>>>>>> mode = %d <<<<<<<<<<<----------\n", mode);
|
||||
printf("----------->>>>>>>>>>>>>>> mode = %d <<<<<<<<<<<----------\n", mode);
|
||||
printf("----------->>>>>>>>>>>>>>> mode = %d <<<<<<<<<<<----------\n", mode);
|
||||
printf("----------->>>>>>>>>>>>>>> mode = %d <<<<<<<<<<<----------\n", mode);
|
||||
if (mode == MODE_AUX_LP)
|
||||
{
|
||||
app_task_switch_to(APP_LINEIN_TASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
app_task_switch_to(APP_BT_TASK);
|
||||
}
|
||||
#if 0
|
||||
#if TCFG_APP_BT_EN
|
||||
app_task_switch_to(APP_BT_TASK);
|
||||
#else
|
||||
|
||||
#if TCFG_USB_APPLE_DOCK_EN //苹果iap协议使用pc模式
|
||||
#if TCFG_USB_APPLE_DOCK_EN // 苹果iap协议使用pc模式
|
||||
app_task_switch_to(APP_PC_TASK);
|
||||
#else
|
||||
app_task_switch_to(APP_SLEEP_TASK);
|
||||
@ -74,6 +106,7 @@ static int power_on_init(void)
|
||||
/* app_task_switch_to(APP_IDLE_TASK); */
|
||||
/* app_task_switch_to(APP_LINEIN_TASK);//如果带检测,设备不在线,则不跳转 */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -88,14 +121,10 @@ static int power_on_unint(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static int poweron_sys_event_handler(struct sys_event *event)
|
||||
{
|
||||
switch (event->type) {
|
||||
switch (event->type)
|
||||
{
|
||||
case SYS_KEY_EVENT:
|
||||
break;
|
||||
case SYS_BT_EVENT:
|
||||
@ -108,53 +137,56 @@ static int poweron_sys_event_handler(struct sys_event *event)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static void tone_play_end_callback(void *priv, int flag)
|
||||
static void tone_play_end_callback(void *priv, int flag)
|
||||
{
|
||||
int index = (int)priv;
|
||||
|
||||
if (APP_POWERON_TASK != app_get_curr_task()) {
|
||||
if (APP_POWERON_TASK != app_get_curr_task())
|
||||
{
|
||||
log_error("tone callback task out \n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (index) {
|
||||
switch (index)
|
||||
{
|
||||
case IDEX_TONE_POWER_ON:
|
||||
power_on_init();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void app_poweron_task()
|
||||
{
|
||||
int msg[32];
|
||||
|
||||
kt_init();
|
||||
|
||||
UI_SHOW_MENU(MENU_POWER_UP, 0, 0, NULL);
|
||||
|
||||
int err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_POWER_ON], 1, tone_play_end_callback, (void *)IDEX_TONE_POWER_ON);
|
||||
// int err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_POWER_ON], 1, tone_play_end_callback, (void *)IDEX_TONE_POWER_ON);
|
||||
/* if (err) { //提示音没有,播放失败,直接init流程 */
|
||||
/* power_on_init(); */
|
||||
power_on_init(); /* */
|
||||
/* } */
|
||||
|
||||
|
||||
while (1) {
|
||||
while (1)
|
||||
{
|
||||
app_task_get_msg(msg, ARRAY_SIZE(msg), 1);
|
||||
switch (msg[0]) {
|
||||
switch (msg[0])
|
||||
{
|
||||
case APP_MSG_SYS_EVENT:
|
||||
if (poweron_sys_event_handler((struct sys_event *)(msg + 1)) == false) {
|
||||
app_default_event_deal((struct sys_event *)(&msg[1])); //由common统一处理
|
||||
if (poweron_sys_event_handler((struct sys_event *)(msg + 1)) == false)
|
||||
{
|
||||
app_default_event_deal((struct sys_event *)(&msg[1])); // 由common统一处理
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (app_task_exitting()) {
|
||||
if (app_task_exitting())
|
||||
{
|
||||
power_on_unint();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
#if TCFG_IIS_ENABLE
|
||||
|
||||
#define ALINK_TEST_ENABLE
|
||||
//#define ALINK_TEST_ENABLE
|
||||
|
||||
#define ALINK_DEBUG_INFO
|
||||
#ifdef ALINK_DEBUG_INFO
|
||||
|
||||
@ -113,8 +113,9 @@
|
||||
#define AUDIO_OUTPUT_ONLY_IIS \
|
||||
(TCFG_IIS_ENABLE && TCFG_IIS_OUTPUT_EN && AUDIO_OUTPUT_WAY == AUDIO_OUTPUT_WAY_IIS)
|
||||
|
||||
#define AUDIO_OUTPUT_DAC_AND_IIS \
|
||||
(AUDIO_OUTPUT_WAY == AUDIO_OUTPUT_WAY_DAC_IIS && TCFG_IIS_ENABLE && TCFG_IIS_OUTPUT_EN)
|
||||
//#define AUDIO_OUTPUT_DAC_AND_IIS \
|
||||
// (AUDIO_OUTPUT_WAY == AUDIO_OUTPUT_WAY_DAC_IIS && TCFG_IIS_ENABLE && TCFG_IIS_OUTPUT_EN)
|
||||
#define AUDIO_OUTPUT_DAC_AND_IIS 1
|
||||
#else
|
||||
#define AUDIO_OUTPUT_ONLY_IIS 0
|
||||
|
||||
|
||||
@ -1007,10 +1007,37 @@ REGISTER_LP_TARGET(audio_dec_init_lp_target) = {
|
||||
|
||||
|
||||
#if AUDIO_OUTPUT_AUTOMUTE
|
||||
#include "kt.h"
|
||||
#include "app_task.h"
|
||||
#include "bt_emitter.h"
|
||||
|
||||
void audio_mix_out_automute_mute(u8 mute)
|
||||
{
|
||||
printf(">>>>>>>>>>>>>>>>>>>> %s\n", mute ? ("MUTE") : ("UNMUTE"));
|
||||
//printf(">>>>>>>>>>>>>>>>>>>> %s\n", mute ? ("MUTE") : ("UNMUTE"));
|
||||
if(app_get_curr_task() == APP_LINEIN_TASK)
|
||||
{
|
||||
if (mute)
|
||||
{
|
||||
bt_emitter_pp(0);
|
||||
//PA_MUTE();
|
||||
}
|
||||
else
|
||||
{
|
||||
bt_emitter_pp(1);
|
||||
if (kt_get_curr_mode() == MODE_BT_EMITTER)
|
||||
{
|
||||
//PA_MUTE();
|
||||
}
|
||||
else
|
||||
{
|
||||
PA_UNMUTE();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PA_UNMUTE();
|
||||
}
|
||||
}
|
||||
|
||||
/* #define AUDIO_E_DET_UNMUTE (0x00) */
|
||||
|
||||
@ -1280,7 +1280,8 @@ static void esco_audio_res_close(void)
|
||||
bt_esco_dec->dec.start = 0;
|
||||
bt_esco_dec->dec.enc_start = 0;
|
||||
#if (TCFG_IIS_ENABLE && TCFG_IIS_OUTPUT_EN)
|
||||
audio_aec_ref_src_close();
|
||||
//flym 20251014 20:10:00
|
||||
//audio_aec_ref_src_close();
|
||||
#endif //(TCFG_IIS_ENABLE && TCFG_IIS_OUTPUT_EN)
|
||||
audio_aec_close();
|
||||
esco_enc_close();
|
||||
@ -1571,7 +1572,8 @@ static int esco_dec_start()
|
||||
|
||||
err = audio_aec_init(dec->dec.sample_rate);
|
||||
#if (TCFG_IIS_ENABLE && TCFG_IIS_OUTPUT_EN)
|
||||
audio_aec_ref_src_open();
|
||||
//flym 20251014 20:10:00
|
||||
//audio_aec_ref_src_open();
|
||||
#endif //(TCFG_IIS_ENABLE && TCFG_IIS_OUTPUT_EN)
|
||||
if (err) {
|
||||
log_i("audio_aec_init failed:%d", err);
|
||||
|
||||
@ -324,6 +324,7 @@ static int tone_dec_file_app_evt_cb(void *priv, enum audio_dec_app_event event,
|
||||
|
||||
clock_add_set(DEC_TONE_CLK);
|
||||
audio_dec_file_app_init_ok(file_dec);
|
||||
//flym 20251014 19:02
|
||||
__bt_emitter_pp(1);
|
||||
break;
|
||||
case AUDIO_DEC_APP_EVENT_DEC_CLOSE:
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#include "app_config.h"
|
||||
#include "audio_mic/effect_parm.h"
|
||||
|
||||
|
||||
|
||||
#define PARM_DEBUG 0
|
||||
|
||||
#define LOG_TAG "[EFFECT]"
|
||||
@ -22,7 +24,8 @@
|
||||
#pragma code_seg(".audio_effect_adj_code")
|
||||
#endif
|
||||
|
||||
#define EFF_CFG_FILE_NAME SDFILE_RES_ROOT_PATH"eq_cfg_hw.bin"
|
||||
//#define EFF_CFG_FILE_NAME SDFILE_RES_ROOT_PATH"eq_cfg_hw.bin"
|
||||
u8 EFF_CFG_FILE_NAME[48] = SDFILE_RES_ROOT_PATH"eq_cfg_hw.bin";
|
||||
const u8 eff_sdk_name[16] = "AC695N";
|
||||
const u8 eff_eq_ver[4] = {1, 0, 0, 0};
|
||||
|
||||
@ -1746,3 +1749,66 @@ int eff_init(void)
|
||||
return 0;
|
||||
}
|
||||
__initcall(eff_init);
|
||||
|
||||
/*
|
||||
*设置eq更新标志,eq运行时会重新调用系数回调,获取系数
|
||||
* */
|
||||
static void cur_eq_update(u32 eq_name)
|
||||
{
|
||||
struct audio_eq *eq = get_cur_eq_hdl_by_name(eq_name);
|
||||
local_irq_disable();
|
||||
if (eq) {
|
||||
eq->mask[0] = (u32)-1;
|
||||
eq->mask[1] = (u32)-1;
|
||||
eq->updata = 1;
|
||||
}
|
||||
local_irq_enable();
|
||||
}
|
||||
/*
|
||||
*设置drc更新标志,drc运行时会重新调用系数回调,获取系数
|
||||
* */
|
||||
static void cur_drc_update(u32 drc_name)
|
||||
{
|
||||
struct audio_drc *drc = get_cur_drc_hdl_by_name(drc_name);
|
||||
local_irq_disable();
|
||||
if (drc) {
|
||||
drc->updata = 1;
|
||||
}
|
||||
local_irq_enable();
|
||||
|
||||
}
|
||||
/*
|
||||
*效果文件切换
|
||||
*path:效果文件路径
|
||||
* */
|
||||
void eff_file_switch(u8 *path)
|
||||
{
|
||||
printf("--------------------------------------------------------->EQ SW to %s \n",path);
|
||||
//更新效果文件路径
|
||||
memcpy(EFF_CFG_FILE_NAME, path, strlen(path));
|
||||
//重新解析效果文件
|
||||
phone_eff_analyze_data();
|
||||
music_eff_analyze_data();
|
||||
#if (TCFG_EQ_ENABLE != 0)
|
||||
cp_eq_file_seg_to_custom_tab();
|
||||
#endif
|
||||
#if defined(LINEIN_MODE_SOLE_EQ_EN) && LINEIN_MODE_SOLE_EQ_EN
|
||||
linein_eff_analyze_data();
|
||||
#endif
|
||||
|
||||
#if defined(TCFG_MIC_EFFECT_ENABLE) && TCFG_MIC_EFFECT_ENABLE
|
||||
for (int i = 0 ; i < EFFECT_REVERB_PARM_MAX; i++) {
|
||||
mic_eff_analyze_data(i);
|
||||
}
|
||||
#endif
|
||||
|
||||
//设置需要更新的模块
|
||||
//audio_vbass_update_demo(AEID_MUSIC_VBASS, &vbass_parm.parm, vbass_parm.is_bypass);
|
||||
int i = 0;
|
||||
for(i=0;i<4;i++){
|
||||
cur_drc_set_update(AEID_MUSIC_DRC, i, &music_mode.drc_parm.wdrc_parm[i]);
|
||||
cur_drc_set_bypass(AEID_MUSIC_DRC, i,&music_mode.drc_parm.wdrc_parm[i].is_bypass);
|
||||
}
|
||||
|
||||
//eq_mode_set(EQ_MODE_CUSTOM); //flym 250614
|
||||
}
|
||||
|
||||
@ -7,101 +7,103 @@
|
||||
#include "online_db/online_db_deal.h"
|
||||
#include "media/audio_eq_drc_apply.h"
|
||||
#include "config/config_interface.h"
|
||||
#include "media/eq_config.h"
|
||||
#include "audio_effect/audio_eff_default_parm.h"
|
||||
|
||||
|
||||
//eq_cfg_hw.bin中播歌eq曲线,当作用户自定义模式,参与效果切换.
|
||||
#define EQ_FILE_CP_TO_CUSTOM 0
|
||||
// eq_cfg_hw.bin中播歌eq曲线,当作用户自定义模式,参与效果切换.
|
||||
#define EQ_FILE_CP_TO_CUSTOM 1
|
||||
|
||||
#if (TCFG_EQ_ENABLE != 0)
|
||||
|
||||
const struct eq_seg_info eq_tab_normal[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 0, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 0, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 0, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 0, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 0, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 0, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 0, 0.7f},
|
||||
};
|
||||
|
||||
const struct eq_seg_info eq_tab_rock[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, -2, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 2, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 4, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, -2, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, -2, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 4, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 4, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, -2, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 2, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 4, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, -2, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, -2, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 4, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 4, 0.7f},
|
||||
};
|
||||
|
||||
const struct eq_seg_info eq_tab_pop[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 3, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 1, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, -2, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, -4, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, -4, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, -2, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 1, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 2, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 3, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 1, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, -2, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, -4, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, -4, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, -2, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 1, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 2, 0.7f},
|
||||
};
|
||||
|
||||
const struct eq_seg_info eq_tab_classic[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 8, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 8, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 4, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 0, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 2, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 2, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 8, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 8, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 4, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 0, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 2, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 2, 0.7f},
|
||||
|
||||
};
|
||||
|
||||
const struct eq_seg_info eq_tab_country[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, -2, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 2, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 2, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 4, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 4, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, -2, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 2, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 2, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 4, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 4, 0.7f},
|
||||
};
|
||||
|
||||
const struct eq_seg_info eq_tab_jazz[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 4, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 4, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 4, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 2, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 3, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 4, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 4, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 4, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 4, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 2, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 3, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 4, 0.7f},
|
||||
};
|
||||
struct eq_seg_info eq_tab_custom[] = {
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 0, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 0, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 0, 0.7f},
|
||||
{0, EQ_IIR_TYPE_BAND_PASS, 31, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 62, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 125, 0, 0.7f},
|
||||
{3, EQ_IIR_TYPE_BAND_PASS, 250, 0, 0.7f},
|
||||
{4, EQ_IIR_TYPE_BAND_PASS, 500, 0, 0.7f},
|
||||
{5, EQ_IIR_TYPE_BAND_PASS, 1000, 0, 0.7f},
|
||||
{6, EQ_IIR_TYPE_BAND_PASS, 2000, 0, 0.7f},
|
||||
{7, EQ_IIR_TYPE_BAND_PASS, 4000, 0, 0.7f},
|
||||
{8, EQ_IIR_TYPE_BAND_PASS, 8000, 0, 0.7f},
|
||||
{9, EQ_IIR_TYPE_BAND_PASS, 16000, 0, 0.7f},
|
||||
};
|
||||
|
||||
@ -118,68 +120,71 @@ float globa_gain_tab[EQ_MODE_MAX] = {0, 0, 0, 0, 0, 0, 0};
|
||||
* */
|
||||
|
||||
const struct eq_seg_info phone_eq_tab_normal[] = {
|
||||
{0, EQ_IIR_TYPE_HIGH_PASS, 200, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 300, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 400, 0, 0.7f},
|
||||
{0, EQ_IIR_TYPE_HIGH_PASS, 200, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 300, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 400, 0, 0.7f},
|
||||
};
|
||||
|
||||
/*
|
||||
*通话上行eq系数表
|
||||
* */
|
||||
const struct eq_seg_info ul_eq_tab_normal[] = {
|
||||
{0, EQ_IIR_TYPE_HIGH_PASS, 200, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 300, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 400, 0, 0.7f},
|
||||
{0, EQ_IIR_TYPE_HIGH_PASS, 200, 0, 0.7f},
|
||||
{1, EQ_IIR_TYPE_BAND_PASS, 300, 0, 0.7f},
|
||||
{2, EQ_IIR_TYPE_BAND_PASS, 400, 0, 0.7f},
|
||||
};
|
||||
|
||||
static u8 eq_mode = 0;
|
||||
//eq效果表切换
|
||||
// eq效果表切换
|
||||
int eq_mode_sw(void)
|
||||
{
|
||||
eq_mode++;
|
||||
if (eq_mode >= ARRAY_SIZE(eq_type_tab)) {
|
||||
if (eq_mode >= ARRAY_SIZE(eq_type_tab)){
|
||||
eq_mode = 0;
|
||||
}
|
||||
struct eq_seg_info *seg = eq_type_tab[eq_mode];
|
||||
|
||||
u8 nsection = ARRAY_SIZE(eq_tab_normal);
|
||||
if (nsection > mSECTION_MAX) {
|
||||
if (nsection > mSECTION_MAX){
|
||||
log_e("ERROR nsection:%d > mSECTION_MAX:%d ", nsection, mSECTION_MAX);
|
||||
return -1;//
|
||||
return -1; //
|
||||
}
|
||||
/* music_mode.eq_parm.seg_num = nsection; */
|
||||
/* music_mode.eq_parm.global_gain = globa_gain_tab[eq_mode]; */
|
||||
cur_eq_set_global_gain(AEID_MUSIC_EQ, globa_gain_tab[eq_mode]);
|
||||
for (int i = 0; i < nsection; i++) {
|
||||
for (int i = 0; i < nsection; i++){
|
||||
/* memcpy(&music_mode.eq_parm.seg[i], &seg[i], sizeof(struct eq_seg_info)); */
|
||||
cur_eq_set_update(AEID_MUSIC_EQ, &seg[i], nsection, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//指定设置某个eq效果表
|
||||
// 指定设置某个eq效果表
|
||||
int eq_mode_set(EQ_MODE mode)
|
||||
{
|
||||
if (eq_mode >= ARRAY_SIZE(eq_type_tab)) {
|
||||
eq_mode = mode;
|
||||
if (eq_mode >= ARRAY_SIZE(eq_type_tab)){
|
||||
eq_mode = 0;
|
||||
}
|
||||
struct eq_seg_info *seg = eq_type_tab[eq_mode];
|
||||
u8 nsection = ARRAY_SIZE(eq_tab_normal);
|
||||
if (nsection > mSECTION_MAX) {
|
||||
if (nsection > mSECTION_MAX){
|
||||
log_e("ERROR nsection:%d > mSECTION_MAX:%d ", nsection, mSECTION_MAX);
|
||||
return -1;//
|
||||
return -1; //
|
||||
}
|
||||
|
||||
u32 design = 1;
|
||||
/* music_mode.eq_parm.seg_num = nsection; */
|
||||
/* music_mode.eq_parm.global_gain = globa_gain_tab[eq_mode]; */
|
||||
cur_eq_set_global_gain(AEID_MUSIC_EQ, globa_gain_tab[eq_mode]);
|
||||
for (int i = 0; i < nsection; i++) {
|
||||
for (int i = 0; i < nsection; i++){
|
||||
/* memcpy(&music_mode.eq_parm.seg[i], &seg[i], sizeof(struct eq_seg_info)); */
|
||||
cur_eq_set_update(AEID_MUSIC_EQ, &seg[i], nsection, 1);
|
||||
cur_eq_set_update(AEID_MUSIC_EQ, &seg[i], nsection, design);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//返回某个eq效果模式标号
|
||||
// 返回某个eq效果模式标号
|
||||
EQ_MODE eq_mode_get_cur(void)
|
||||
{
|
||||
return eq_mode;
|
||||
@ -197,7 +202,7 @@ int eq_mode_set_custom_seg(struct eq_seg_info *seg)
|
||||
{
|
||||
struct eq_seg_info *tar_seg = eq_tab_custom;
|
||||
u8 index = seg->index;
|
||||
if (index > ARRAY_SIZE(eq_tab_custom)) {
|
||||
if (index > ARRAY_SIZE(eq_tab_custom)){
|
||||
log_e("index %d > max_nsection %d", index, ARRAY_SIZE(eq_tab_custom));
|
||||
return -1;
|
||||
}
|
||||
@ -214,7 +219,7 @@ int eq_mode_set_custom_seg(struct eq_seg_info *seg)
|
||||
/*----------------------------------------------------------------------------*/
|
||||
struct eq_seg_info *eq_mode_get_seg(EQ_MODE mode, u8 index)
|
||||
{
|
||||
if (mode >= ARRAY_SIZE(eq_type_tab)) {
|
||||
if (mode >= ARRAY_SIZE(eq_type_tab)){
|
||||
return NULL;
|
||||
}
|
||||
struct eq_seg_info *seg = eq_type_tab[mode];
|
||||
@ -226,32 +231,35 @@ struct eq_seg_info *eq_mode_get_seg(EQ_MODE mode, u8 index)
|
||||
* */
|
||||
int eq_mode_set_custom_info(u16 index, int freq, float gain)
|
||||
{
|
||||
struct eq_seg_info *seg = eq_mode_get_seg(EQ_MODE_CUSTOM, index);//获取某段eq系数
|
||||
if (!seg) {
|
||||
struct eq_seg_info *seg = eq_mode_get_seg(EQ_MODE_CUSTOM, index); // 获取某段eq系数
|
||||
if (!seg){
|
||||
return -1;
|
||||
}
|
||||
seg->freq = freq;//修改freq gain
|
||||
seg->freq = freq; // 修改freq gain
|
||||
seg->gain = gain;
|
||||
eq_mode_set_custom_seg(seg);//重设系数
|
||||
eq_mode_set_custom_seg(seg); // 重设系数
|
||||
|
||||
eq_mode_set(EQ_MODE_CUSTOM);//设置更新系数
|
||||
eq_mode_set(EQ_MODE_CUSTOM); // 设置更新系数
|
||||
return 0;
|
||||
}
|
||||
void cp_eq_file_seg_to_custom_tab()
|
||||
{
|
||||
printf("[%s]------------Row[%d]",__FUNCTION__,__LINE__);
|
||||
#if EQ_FILE_CP_TO_CUSTOM
|
||||
u8 nsection = music_mode.eq_parm.seg_num;
|
||||
struct eq_seg_info *seg = eq_tab_custom;
|
||||
for (nsection > ARRAY_SIZE(eq_tab_custom)) {
|
||||
if (nsection > ARRAY_SIZE(eq_tab_custom)) {
|
||||
log_e("music nsection:%d > custom nsection:%d\n", nsection, ARRAY_SIZE(eq_tab_custom));
|
||||
return ;
|
||||
}
|
||||
printf("music_mode.eq_parm.global_gain == %d\n",(int)((int)(music_mode.eq_parm.global_gain*100)/100));
|
||||
globa_gain_tab[EQ_MODE_CUSTOM] = music_mode.eq_parm.global_gain;
|
||||
memcpy(seg, music_mode.eq_parm.seg, sizeof(struct eq_seg_info)*nsection);
|
||||
|
||||
eq_mode = EQ_MODE_CUSTOM;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int eq_init(void)
|
||||
{
|
||||
audio_eq_init();
|
||||
@ -260,5 +268,4 @@ int eq_init(void)
|
||||
}
|
||||
__initcall(eq_init);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@ -30,6 +30,7 @@ cvsd_encoder
|
||||
|
||||
|
||||
msbc_encoder
|
||||
pcm_encoder
|
||||
sbc_encoder
|
||||
|
||||
|
||||
|
||||
BIN
cpu/br23/tools/app.bin
Normal file
BIN
cpu/br23/tools/app.bin
Normal file
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -63,5 +63,6 @@ del data.bin
|
||||
del data_code.bin
|
||||
del text.bin
|
||||
del *.bc
|
||||
copy .\effect_file\music_base.bin eq_cfg_hw.bin
|
||||
copy .\effect_file\music_base.bin eq_cfg_h1.bin
|
||||
copy .\effect_file\music_base_linein.bin eq_cfg_h2.bin
|
||||
download\standard\download.bat
|
||||
|
||||
@ -211,7 +211,8 @@ copy .\effect_file\music_2to1_2to2.bin eq_cfg_hw.bin
|
||||
#elif defined(LINEIN_MODE_SOLE_EQ_EN) && LINEIN_MODE_SOLE_EQ_EN
|
||||
copy .\effect_file\music_base_linein.bin eq_cfg_hw.bin
|
||||
#else
|
||||
copy .\effect_file\music_base.bin eq_cfg_hw.bin
|
||||
copy .\effect_file\music_base.bin eq_cfg_h1.bin
|
||||
copy .\effect_file\music_base_linein.bin eq_cfg_h2.bin
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
1
cpu/br23/tools/download/standard/KTS_AC690x_5458.key
Normal file
1
cpu/br23/tools/download/standard/KTS_AC690x_5458.key
Normal file
@ -0,0 +1 @@
|
||||
44b10a8a9a97a7ea8795ce48fe8bb180954fc20c5763ded5954fc20c5763ded5399f4f1d
|
||||
BIN
cpu/br23/tools/download/standard/app.bin
Normal file
BIN
cpu/br23/tools/download/standard/app.bin
Normal file
Binary file not shown.
Binary file not shown.
@ -8,12 +8,14 @@ copy ..\..\tone.cfg .
|
||||
copy ..\..\cfg_tool.bin .
|
||||
copy ..\..\app.bin .
|
||||
copy ..\..\br23loader.bin .
|
||||
copy ..\..\eq_cfg_hw.bin .
|
||||
copy ..\..\eq_cfg_h1.bin .
|
||||
copy ..\..\eq_cfg_h2.bin .
|
||||
copy ..\..\ota_all.bin .
|
||||
copy ..\..\ota_nor.bin .
|
||||
|
||||
|
||||
..\..\isd_download.exe -tonorflash -dev br23 -boot 0x12000 -div8 -wait 300 -uboot uboot.boot -app app.bin -res tone.cfg cfg_tool.bin eq_cfg_hw.bin %1 -format all
|
||||
::..\..\isd_download.exe -tonorflash -dev br23 -boot 0x12000 -div8 -wait 300 -uboot uboot.boot -app app.bin -res tone.cfg cfg_tool.bin eq_cfg_hw.bin eq_cfg_h1.bin eq_cfg_h2.bin %1 -format all -key KTS_AC690x_5458.key
|
||||
..\..\isd_download.exe -tonorflash -dev br23 -boot 0x12000 -div8 -wait 300 -uboot uboot.boot -app app.bin -res tone.cfg cfg_tool.bin eq_cfg_hw.bin eq_cfg_h1.bin eq_cfg_h2.bin -format all %1 -key KTS_AC690x_5458.key
|
||||
:: -format all
|
||||
::-reboot 2500
|
||||
|
||||
|
||||
BIN
cpu/br23/tools/download/standard/eq_cfg_h1.bin
Normal file
BIN
cpu/br23/tools/download/standard/eq_cfg_h1.bin
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/eq_cfg_h2.bin
Normal file
BIN
cpu/br23/tools/download/standard/eq_cfg_h2.bin
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/jl_isd.bin
Normal file
BIN
cpu/br23/tools/download/standard/jl_isd.bin
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/jl_isd.fw
Normal file
BIN
cpu/br23/tools/download/standard/jl_isd.fw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/download/standard/nor_update.ufw
Normal file
BIN
cpu/br23/tools/download/standard/nor_update.ufw
Normal file
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update.ufw
Normal file
Binary file not shown.
BIN
cpu/br23/tools/effect_file/music_base - 副本.bin
Normal file
BIN
cpu/br23/tools/effect_file/music_base - 副本.bin
Normal file
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/effect_file/music_base_linein - 副本 (2).bin
Normal file
BIN
cpu/br23/tools/effect_file/music_base_linein - 副本 (2).bin
Normal file
Binary file not shown.
BIN
cpu/br23/tools/effect_file/music_base_linein - 副本.bin
Normal file
BIN
cpu/br23/tools/effect_file/music_base_linein - 副本.bin
Normal file
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/eq_cfg_h1.bin
Normal file
BIN
cpu/br23/tools/eq_cfg_h1.bin
Normal file
Binary file not shown.
BIN
cpu/br23/tools/eq_cfg_h2.bin
Normal file
BIN
cpu/br23/tools/eq_cfg_h2.bin
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
18492
cpu/br23/tools/sdk.elf.resolution.txt
Normal file
18492
cpu/br23/tools/sdk.elf.resolution.txt
Normal file
File diff suppressed because it is too large
Load Diff
157339
cpu/br23/tools/sdk.lst
Normal file
157339
cpu/br23/tools/sdk.lst
Normal file
File diff suppressed because it is too large
Load Diff
60880
cpu/br23/tools/symbol_tbl.txt
Normal file
60880
cpu/br23/tools/symbol_tbl.txt
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
BIN
tone/bt_conn.mp3
Normal file
BIN
tone/bt_conn.mp3
Normal file
Binary file not shown.
BIN
tone/bt_conn.wtg
Normal file
BIN
tone/bt_conn.wtg
Normal file
Binary file not shown.
BIN
tone/bt_dcon.mp3
Normal file
BIN
tone/bt_dcon.mp3
Normal file
Binary file not shown.
BIN
tone/bt_dcon.wtg
Normal file
BIN
tone/bt_dcon.wtg
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user