添加AD调整音量,PA10
This commit is contained in:
parent
9a361cd5c2
commit
10fba331b8
@ -1,17 +1,26 @@
|
||||
#include "kt.h"
|
||||
#include "app_task.h"
|
||||
#include "avctp_user.h"
|
||||
#include "audio_config.h"
|
||||
|
||||
extern void kt_auto_mute_pa_init(void);
|
||||
|
||||
static u16 led_timer_id = 0;
|
||||
static int led_cnt = 0;
|
||||
static u8 curr_volume = 0;
|
||||
static int vol_get_cnt = 0;
|
||||
|
||||
/* static int mute_test = 0;
|
||||
static u8 mute_test_flag = 0; */
|
||||
|
||||
void kt_boot_init(void)
|
||||
{
|
||||
//volume pin PA10
|
||||
adc_add_sample_ch(AD_CH_PA10);
|
||||
gpio_set_die(IO_PORTA_10, 0);
|
||||
gpio_set_direction(IO_PORTA_10, 1);
|
||||
gpio_set_pull_down(IO_PORTA_10, 0);
|
||||
gpio_set_pull_up(IO_PORTA_10, 0);
|
||||
// mute pin
|
||||
gpio_set_pull_up(KT_CFG_MUTE_PIN, 0);
|
||||
gpio_set_pull_down(KT_CFG_MUTE_PIN, 0);
|
||||
@ -70,6 +79,34 @@ static void led_timer_callback(void *priv)
|
||||
mute_test_flag = 1;
|
||||
}
|
||||
} */
|
||||
vol_get_cnt++;
|
||||
if (vol_get_cnt >= 2)
|
||||
{
|
||||
vol_get_cnt = 0;
|
||||
//curr_volume = adc_get_value(KT_CFG_VOLUME_ADC_CH);
|
||||
//printf("curr_volume: %d\n", curr_volume);
|
||||
u8 vol = app_audio_get_volume(APP_AUDIO_STATE_MUSIC);
|
||||
u8 max_vol = get_max_sys_vol();
|
||||
//采集电位器,对应音量值
|
||||
{
|
||||
u16 adc_val = adc_get_value(KT_CFG_VOLUME_ADC_CH);
|
||||
u8 pot_vol = (u8)((u32)adc_val * max_vol / 1023);
|
||||
if (pot_vol > max_vol)
|
||||
{
|
||||
pot_vol = max_vol;
|
||||
}
|
||||
|
||||
/* 避免重复设置同一音量,降低抖动与无效调用 */
|
||||
if (pot_vol != curr_volume)
|
||||
{
|
||||
curr_volume = pot_vol;
|
||||
}
|
||||
if (curr_volume != vol)
|
||||
{
|
||||
app_audio_set_volume(APP_AUDIO_STATE_MUSIC, curr_volume, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (app_get_curr_task() == APP_BT_TASK)
|
||||
{
|
||||
|
||||
@ -21,6 +21,9 @@
|
||||
#define PA_MUTE() do { printf("[<"); gpio_set_output_value(KT_CFG_MUTE_PIN, 0); } while(0)
|
||||
#define PA_UNMUTE() do { printf(">]"); gpio_set_output_value(KT_CFG_MUTE_PIN, 1); } while(0)
|
||||
|
||||
#define KT_CFG_VOLUME_PIN IO_PORTA_10
|
||||
#define KT_CFG_VOLUME_ADC_CH AD_CH_PA10
|
||||
|
||||
//#define PA_MUTE()
|
||||
//#define PA_UNMUTE()
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
#define CONFIG_DEBUG_LIB(x) (x & LIB_DEBUG)
|
||||
|
||||
#define CONFIG_DEBUG_ENABLE
|
||||
//#define CONFIG_DEBUG_ENABLE
|
||||
|
||||
#ifndef CONFIG_DEBUG_ENABLE
|
||||
//#define CONFIG_DEBUG_LITE_ENABLE //轻量级打印开关, 默认关闭
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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_JM317_701E.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_JM317_701E.ufw
Normal file
Binary file not shown.
Binary file not shown.
@ -201,6 +201,17 @@ objs/apps/common/config/bt_profile_config.c.o
|
||||
-r=objs/apps/common/config/bt_profile_config.c.o,btstack_emitter_support,pl
|
||||
objs/apps/common/config/ci_transport_uart.c.o
|
||||
objs/apps/common/debug/debug.c.o
|
||||
-r=objs/apps/common/debug/debug.c.o,putchar,pl
|
||||
-r=objs/apps/common/debug/debug.c.o,puts,pl
|
||||
-r=objs/apps/common/debug/debug.c.o,printf,pl
|
||||
-r=objs/apps/common/debug/debug.c.o,put_buf,pl
|
||||
-r=objs/apps/common/debug/debug.c.o,put_u8hex,pl
|
||||
-r=objs/apps/common/debug/debug.c.o,put_u16hex,pl
|
||||
-r=objs/apps/common/debug/debug.c.o,put_u32hex,pl
|
||||
-r=objs/apps/common/debug/debug.c.o,log_print,pl
|
||||
-r=objs/apps/common/debug/debug.c.o,log_putbyte,pl
|
||||
-r=objs/apps/common/debug/debug.c.o,assert_printf,pl
|
||||
-r=objs/apps/common/debug/debug.c.o,cpu_assert_debug,l
|
||||
objs/apps/common/debug/debug_lite.c.o
|
||||
-r=objs/apps/common/debug/debug_lite.c.o,puts_lite,pl
|
||||
-r=objs/apps/common/debug/debug_lite.c.o,put_buf_lite,pl
|
||||
@ -1532,9 +1543,6 @@ objs/apps/common/update/update.c.o
|
||||
-r=objs/apps/common/update/update.c.o,pwm_led_mode_set,l
|
||||
-r=objs/apps/common/update/update.c.o,led_update_finish,pl
|
||||
-r=objs/apps/common/update/update.c.o,update_result_deal,pl
|
||||
-r=objs/apps/common/update/update.c.o,check_update_param_len,l
|
||||
-r=objs/apps/common/update/update.c.o,printf,l
|
||||
-r=objs/apps/common/update/update.c.o,cpu_assert_debug,l
|
||||
-r=objs/apps/common/update/update.c.o,wdt_clear,l
|
||||
-r=objs/apps/common/update/update.c.o,app_audio_set_volume,l
|
||||
-r=objs/apps/common/update/update.c.o,get_max_sys_vol,l
|
||||
@ -1545,6 +1553,7 @@ objs/apps/common/update/update.c.o
|
||||
-r=objs/apps/common/update/update.c.o,update_close_hw,pl
|
||||
-r=objs/apps/common/update/update.c.o,memcmp,l
|
||||
-r=objs/apps/common/update/update.c.o,strlen,l
|
||||
-r=objs/apps/common/update/update.c.o,printf,l
|
||||
-r=objs/apps/common/update/update.c.o,updata_parm_set,pl
|
||||
-r=objs/apps/common/update/update.c.o,le_controller_get_mac,l
|
||||
-r=objs/apps/common/update/update.c.o,put_buf,l
|
||||
@ -1563,6 +1572,7 @@ objs/apps/common/update/update.c.o
|
||||
-r=objs/apps/common/update/update.c.o,update_mode_api_v2,pl
|
||||
-r=objs/apps/common/update/update.c.o,malloc,l
|
||||
-r=objs/apps/common/update/update.c.o,free,l
|
||||
-r=objs/apps/common/update/update.c.o,cpu_assert_debug,l
|
||||
-r=objs/apps/common/update/update.c.o,update_check_sniff_en,pl
|
||||
-r=objs/apps/common/update/update.c.o,get_ota_status,pl
|
||||
-r=objs/apps/common/update/update.c.o,p33_soft_reset,l
|
||||
@ -1573,12 +1583,12 @@ objs/apps/common/update/update.c.o
|
||||
-r=objs/apps/common/update/update.c.o,g_updata_flag,pl
|
||||
-r=objs/apps/common/update/update.c.o,config_update_mode,l
|
||||
-r=objs/apps/common/update/update.c.o,UPDATA_BEG,
|
||||
-r=objs/apps/common/update/update.c.o,config_asser,l
|
||||
-r=objs/apps/common/update/update.c.o,update_target_begin,
|
||||
-r=objs/apps/common/update/update.c.o,update_target_end,
|
||||
-r=objs/apps/common/update/update.c.o,support_norflash_update_en,l
|
||||
-r=objs/apps/common/update/update.c.o,loader_file_path,pl
|
||||
-r=objs/apps/common/update/update.c.o,config_btctler_modules,l
|
||||
-r=objs/apps/common/update/update.c.o,config_asser,l
|
||||
-r=objs/apps/common/update/update.c.o,ota_lp_target,pl
|
||||
-r=objs/apps/common/update/update.c.o,__initcall_app_update_init,pl
|
||||
objs/apps/common/usb/device/cdc.c.o
|
||||
@ -3092,9 +3102,11 @@ objs/apps/soundbox/soundcard/peripheral.c.o
|
||||
objs/apps/soundbox/soundcard/soundcard.c.o
|
||||
objs/apps/kaotings/kt.c.o
|
||||
-r=objs/apps/kaotings/kt.c.o,kt_boot_init,pl
|
||||
-r=objs/apps/kaotings/kt.c.o,gpio_set_pull_up,l
|
||||
-r=objs/apps/kaotings/kt.c.o,gpio_set_pull_down,l
|
||||
-r=objs/apps/kaotings/kt.c.o,adc_add_sample_ch,l
|
||||
-r=objs/apps/kaotings/kt.c.o,gpio_set_die,l
|
||||
-r=objs/apps/kaotings/kt.c.o,gpio_set_direction,l
|
||||
-r=objs/apps/kaotings/kt.c.o,gpio_set_pull_down,l
|
||||
-r=objs/apps/kaotings/kt.c.o,gpio_set_pull_up,l
|
||||
-r=objs/apps/kaotings/kt.c.o,gpio_set_output_value,l
|
||||
-r=objs/apps/kaotings/kt.c.o,printf,l
|
||||
-r=objs/apps/kaotings/kt.c.o,kt_eq_switch_to,pl
|
||||
@ -3102,6 +3114,10 @@ objs/apps/kaotings/kt.c.o
|
||||
-r=objs/apps/kaotings/kt.c.o,kt_init,pl
|
||||
-r=objs/apps/kaotings/kt.c.o,kt_auto_mute_pa_init,l
|
||||
-r=objs/apps/kaotings/kt.c.o,sys_timer_add,l
|
||||
-r=objs/apps/kaotings/kt.c.o,app_audio_get_volume,l
|
||||
-r=objs/apps/kaotings/kt.c.o,get_max_sys_vol,l
|
||||
-r=objs/apps/kaotings/kt.c.o,adc_get_value,l
|
||||
-r=objs/apps/kaotings/kt.c.o,app_audio_set_volume,l
|
||||
-r=objs/apps/kaotings/kt.c.o,app_get_curr_task,l
|
||||
-r=objs/apps/kaotings/kt.c.o,get_bt_connect_status,l
|
||||
-r=objs/apps/kaotings/kt.c.o,puts,l
|
||||
@ -5477,8 +5493,6 @@ objs/cpu/br23/pwm_led.c.o
|
||||
-r=objs/cpu/br23/pwm_led.c.o,power_param,l
|
||||
objs/cpu/br23/setup.c.o
|
||||
-r=objs/cpu/br23/setup.c.o,cpu_assert_debug,pl
|
||||
-r=objs/cpu/br23/setup.c.o,log_flush,l
|
||||
-r=objs/cpu/br23/setup.c.o,local_irq_disable,l
|
||||
-r=objs/cpu/br23/setup.c.o,timer,pl
|
||||
-r=objs/cpu/br23/setup.c.o,sys_timer_dump_time,l
|
||||
-r=objs/cpu/br23/setup.c.o,test_fun,pl
|
||||
@ -5494,8 +5508,6 @@ objs/cpu/br23/setup.c.o
|
||||
-r=objs/cpu/br23/setup.c.o,clk_early_init,l
|
||||
-r=objs/cpu/br23/setup.c.o,port_init,l
|
||||
-r=objs/cpu/br23/setup.c.o,tick_timer_init,l
|
||||
-r=objs/cpu/br23/setup.c.o,debug_uart_init,l
|
||||
-r=objs/cpu/br23/setup.c.o,log_early_init,l
|
||||
-r=objs/cpu/br23/setup.c.o,printf,l
|
||||
-r=objs/cpu/br23/setup.c.o,clock_dump,l
|
||||
-r=objs/cpu/br23/setup.c.o,reset_source_dump,l
|
||||
@ -5505,6 +5517,7 @@ objs/cpu/br23/setup.c.o
|
||||
-r=objs/cpu/br23/setup.c.o,debug_init,l
|
||||
-r=objs/cpu/br23/setup.c.o,sys_timer_init,l
|
||||
-r=objs/cpu/br23/setup.c.o,__crc16_mutex_init,l
|
||||
-r=objs/cpu/br23/setup.c.o,p33_soft_reset,l
|
||||
-r=objs/cpu/br23/setup.c.o,p33_or_1byte,l
|
||||
-r=objs/cpu/br23/setup.c.o,puts,l
|
||||
-r=objs/cpu/br23/setup.c.o,power_reset_src,pl
|
||||
@ -7312,7 +7325,7 @@ include_lib/liba/br23/system.a.llvm.1326370.init.c
|
||||
-r=include_lib/liba/br23/system.a.llvm.1326370.init.c,late_initcall_begin,
|
||||
-r=include_lib/liba/br23/system.a.llvm.1326370.init.c,late_initcall_end,
|
||||
include_lib/liba/br23/system.a.llvm.1390042.puthex.c
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,putchar,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,putchar,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,log_output_lock,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,log_output_start,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,log_putchar,l
|
||||
@ -7320,16 +7333,16 @@ include_lib/liba/br23/system.a.llvm.1390042.puthex.c
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,log_putbyte,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,log_output_unlock,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,put_u4hex,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,put_u16hex,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,put_u8hex,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,put_u32hex,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,put_u16hex,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,put_u8hex,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,put_u32hex,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,putbyte,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,put_buf,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,put_buf,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,log_put_u8hex,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1390042.puthex.c,printf_buf,pl
|
||||
include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,print,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,puts,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,puts,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,log_output_lock,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,log_output_start,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,strlen,l
|
||||
@ -7338,8 +7351,8 @@ include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,log_putbyte,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,log_print_time,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,log_output_unlock,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,printf,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,assert_printf,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,printf,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,assert_printf,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,local_irq_disable,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,snprintf,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1397010.printf-stdarg.c,vsnprintf,pl
|
||||
@ -7355,12 +7368,12 @@ include_lib/liba/br23/system.a.llvm.1425914.log.c
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,jiffies_msec,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,sprintf,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,log_print_time,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,log_putbyte,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,log_putbyte,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,log_output_lock,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,os_mutex_pend,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,os_mutex_post,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,log_output_unlock,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,log_print,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,log_print,l
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,log_output_start,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,log_putchar,pl
|
||||
-r=include_lib/liba/br23/system.a.llvm.1425914.log.c,lbuf_free,l
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user