功能完成
This commit is contained in:
parent
9fd47355c9
commit
50d8f1f7c1
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"fm_api.h": "c"
|
||||
}
|
||||
}
|
BIN
FW/KT24-1110/KT24-1110_65E-HA651B_A056.fw
Normal file
BIN
FW/KT24-1110/KT24-1110_65E-HA651B_A056.fw
Normal file
Binary file not shown.
BIN
FW/KT24-1110/jl_isd.fw
Normal file
BIN
FW/KT24-1110/jl_isd.fw
Normal file
Binary file not shown.
@ -20,3 +20,4 @@
|
||||
16. AUX PA3 AUX0L
|
||||
17. AUX DET PC4
|
||||
18. LED PB5
|
||||
19. PA2 功放模式,0-ClassD 1-ClassAB
|
@ -17,12 +17,12 @@
|
||||
#define APP_PROTOCOL_DEMO_CODE 0
|
||||
#define APP_PROTOCOL_GMA_CODE 0
|
||||
#define APP_PROTOCOL_AMA_CODE 0
|
||||
#define APP_PROTOCOL_DMA_CODE 1
|
||||
#define APP_PROTOCOL_DMA_CODE 0
|
||||
#define APP_PROTOCOL_TME_CODE 0
|
||||
#define APP_PROTOCOL_MMA_CODE 0
|
||||
|
||||
#define APP_PROTOCOL_SPEECH_EN 1 //语音助手功能,若无此功能则关掉
|
||||
#define APP_PROTOCOL_READ_CFG_EN 1 //从custom.dat中读取配置信息,若无此功能则关掉
|
||||
#define APP_PROTOCOL_SPEECH_EN 0 //语音助手功能,若无此功能则关掉
|
||||
#define APP_PROTOCOL_READ_CFG_EN 0 //从custom.dat中读取配置信息,若无此功能则关掉
|
||||
|
||||
#define DEMO_HANDLER_ID 0x300 /*作为一个使用的例子,同时也可作为客户自己添加协议的ID*/
|
||||
#define GMA_HANDLER_ID 0x400 /*阿里天猫协议接口ID*/
|
||||
|
@ -44,7 +44,7 @@ void board_power_init(void);
|
||||
|
||||
/*各个状态下默认的闪灯方式和提示音设置,如果USER_CFG中设置了USE_CONFIG_STATUS_SETTING为1,则会从配置文件读取对应的配置来填充改结构体*/
|
||||
STATUS_CONFIG status_config = {
|
||||
//提示音设置
|
||||
// 提示音设置
|
||||
.tone = {
|
||||
.charge_start = IDEX_TONE_NONE,
|
||||
.charge_full = IDEX_TONE_NONE,
|
||||
@ -60,12 +60,10 @@ STATUS_CONFIG status_config = {
|
||||
.bt_disconnect = IDEX_TONE_BT_DISCONN,
|
||||
.tws_connect_ok = IDEX_TONE_TWS_CONN,
|
||||
.tws_disconnect = IDEX_TONE_TWS_DISCONN,
|
||||
}
|
||||
};
|
||||
}};
|
||||
|
||||
#define __this (&status_config)
|
||||
|
||||
|
||||
// *INDENT-OFF*
|
||||
/************************** UART config****************************/
|
||||
#if TCFG_UART0_ENABLE
|
||||
@ -75,104 +73,106 @@ UART0_PLATFORM_DATA_BEGIN(uart0_data)
|
||||
.baudrate = TCFG_UART0_BAUDRATE,
|
||||
|
||||
.flags = UART_DEBUG,
|
||||
UART0_PLATFORM_DATA_END()
|
||||
#endif //TCFG_UART0_ENABLE
|
||||
|
||||
UART0_PLATFORM_DATA_END()
|
||||
#endif // TCFG_UART0_ENABLE
|
||||
|
||||
/************************** SD config ****************************/
|
||||
#if TCFG_SD0_ENABLE
|
||||
/* int sdmmc_0_io_detect(const struct sdmmc_platform_data *data) */
|
||||
/* { */
|
||||
/* return 1; */
|
||||
/* } */
|
||||
/* void sd_set_power(u8 enable) */
|
||||
/* { */
|
||||
/* static u8 old_enable = 0xff; */
|
||||
/* */
|
||||
/* if(old_enable == enable){ */
|
||||
/* return; */
|
||||
/* } */
|
||||
/* if(enable){ */
|
||||
/* sdpg_config(1); */
|
||||
/* }else{ */
|
||||
/* sdpg_config(0); */
|
||||
/* } */
|
||||
/* old_enable = enable; */
|
||||
/* } */
|
||||
/* int sdmmc_0_io_detect(const struct sdmmc_platform_data *data) */
|
||||
/* { */
|
||||
/* return 1; */
|
||||
/* } */
|
||||
void sd_set_power(u8 enable)
|
||||
{
|
||||
static u8 old_enable = 0xff;
|
||||
|
||||
if (old_enable == enable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (enable)
|
||||
{
|
||||
sdpg_config(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
sdpg_config(0);
|
||||
}
|
||||
old_enable = enable;
|
||||
}
|
||||
SD0_PLATFORM_DATA_BEGIN(sd0_data)
|
||||
.port = TCFG_SD0_PORTS, //sd0 support port 'A' and port 'B'
|
||||
.port = TCFG_SD0_PORTS, // sd0 support port 'A' and port 'B'
|
||||
.data_width = TCFG_SD0_DAT_MODE,
|
||||
.speed = TCFG_SD0_CLK,
|
||||
.detect_mode = TCFG_SD0_DET_MODE,
|
||||
.priority = 3,
|
||||
#if (TCFG_SD0_DET_MODE == SD_IO_DECT)
|
||||
.detect_io = TCFG_SD0_DET_IO,//当检测模式为io口检测是有效
|
||||
.detect_io_level = TCFG_SD0_DET_IO_LEVEL,//0:低电平检测到卡。 1:高电平检测到卡
|
||||
.detect_func = sdmmc_0_io_detect,//库函数,需要detect_io和detect_io_level两个元素作为参数。可以自行重写一个检测函数,在线返回1,不在线返回0,即可。
|
||||
.power = sd_set_power,//库函数,使用SDPG引脚。可以自行重写其他的SD卡电源控制函数,传入0:关电源。传入1,开电源。如果电源硬件已固定不可控,则该函数无效,可以填NULL
|
||||
/* .power = NULL, */
|
||||
.detect_io = TCFG_SD0_DET_IO, // 当检测模式为io口检测是有效
|
||||
.detect_io_level = TCFG_SD0_DET_IO_LEVEL, // 0:低电平检测到卡。 1:高电平检测到卡
|
||||
.detect_func = sdmmc_0_io_detect, // 库函数,需要detect_io和detect_io_level两个元素作为参数。可以自行重写一个检测函数,在线返回1,不在线返回0,即可。
|
||||
.power = sd_set_power, // 库函数,使用SDPG引脚。可以自行重写其他的SD卡电源控制函数,传入0:关电源。传入1,开电源。如果电源硬件已固定不可控,则该函数无效,可以填NULL
|
||||
/* .power = NULL, */
|
||||
#elif (TCFG_SD0_DET_MODE == SD_CLK_DECT)
|
||||
.detect_io_level = TCFG_SD0_DET_IO_LEVEL,//0:低电平检测到卡。 1:高电平检测到卡
|
||||
.detect_func = sdmmc_0_clk_detect,//库函数,需要detect_io_level元素作为参数。可以自行重写一个检测函数,在线返回1,不在线返回0,即可。
|
||||
.power = sd_set_power,//库函数,使用SDPG引脚。可以自行重写其他的SD卡电源控制函数,传入0:关电源。传入1,开电源。如果电源硬件已固定不可控,则该函数无效,可以填NULL
|
||||
/* .power = NULL, */
|
||||
.detect_io_level = TCFG_SD0_DET_IO_LEVEL, // 0:低电平检测到卡。 1:高电平检测到卡
|
||||
.detect_func = sdmmc_0_clk_detect, // 库函数,需要detect_io_level元素作为参数。可以自行重写一个检测函数,在线返回1,不在线返回0,即可。
|
||||
.power = sd_set_power, // 库函数,使用SDPG引脚。可以自行重写其他的SD卡电源控制函数,传入0:关电源。传入1,开电源。如果电源硬件已固定不可控,则该函数无效,可以填NULL
|
||||
/* .power = NULL, */
|
||||
#else
|
||||
.detect_func = sdmmc_cmd_detect,
|
||||
.power = NULL,//cmd检测需要全程供电,建议用硬件固定电源。当然,可以自行写其他的SD卡电源控制函数,传入0:关电源。传入1,开电源。
|
||||
/* .power = sd_set_power, */
|
||||
.power = NULL, // cmd检测需要全程供电,建议用硬件固定电源。当然,可以自行写其他的SD卡电源控制函数,传入0:关电源。传入1,开电源。
|
||||
/* .power = sd_set_power, */
|
||||
#endif
|
||||
SD0_PLATFORM_DATA_END()
|
||||
SD0_PLATFORM_DATA_END()
|
||||
#endif
|
||||
|
||||
#if TCFG_SD1_ENABLE
|
||||
SD1_PLATFORM_DATA_BEGIN(sd1_data)
|
||||
.port = TCFG_SD1_PORTS, //sd0 support port 'A' and port 'B'
|
||||
SD1_PLATFORM_DATA_BEGIN(sd1_data)
|
||||
.port = TCFG_SD1_PORTS, // sd0 support port 'A' and port 'B'
|
||||
.data_width = TCFG_SD1_DAT_MODE,
|
||||
.speed = TCFG_SD1_CLK,
|
||||
.detect_mode = TCFG_SD1_DET_MODE,
|
||||
.priority = 3,
|
||||
#if (TCFG_SD1_DET_MODE == SD_IO_DECT)
|
||||
.detect_io = TCFG_SD1_DET_IO,//当检测模式为io口检测是有效
|
||||
.detect_io_level = TCFG_SD1_DET_IO_LEVEL,//0:低电平检测到卡。 1:高电平检测到卡
|
||||
.detect_func = sdmmc_0_io_detect,//库函数,需要detect_io和detect_io_level两个元素作为参数。可以自行重写一个检测函数,在线返回1,不在线返回0,即可。
|
||||
.power = sd_set_power,//库函数,使用SDPG引脚。可以自行重写其他的SD卡电源控制函数,传入0:关电源。传入1,开电源。如果电源硬件已固定不可控,则该函数无效,可以填NULL
|
||||
/* .power = NULL, */
|
||||
.detect_io = TCFG_SD1_DET_IO, // 当检测模式为io口检测是有效
|
||||
.detect_io_level = TCFG_SD1_DET_IO_LEVEL, // 0:低电平检测到卡。 1:高电平检测到卡
|
||||
.detect_func = sdmmc_0_io_detect, // 库函数,需要detect_io和detect_io_level两个元素作为参数。可以自行重写一个检测函数,在线返回1,不在线返回0,即可。
|
||||
.power = sd_set_power, // 库函数,使用SDPG引脚。可以自行重写其他的SD卡电源控制函数,传入0:关电源。传入1,开电源。如果电源硬件已固定不可控,则该函数无效,可以填NULL
|
||||
/* .power = NULL, */
|
||||
#elif (TCFG_SD1_DET_MODE == SD_CLK_DECT)
|
||||
.detect_io_level = TCFG_SD1_DET_IO_LEVEL,//0:低电平检测到卡。 1:高电平检测到卡
|
||||
.detect_func = sdmmc_0_clk_detect,//库函数,需要detect_io_level元素作为参数。可以自行重写一个检测函数,在线返回1,不在线返回0,即可。
|
||||
.power = sd_set_power,//库函数,使用SDPG引脚。可以自行重写其他的SD卡电源控制函数,传入0:关电源。传入1,开电源。如果电源硬件已固定不可控,则该函数无效,可以填NULL
|
||||
/* .power = NULL, */
|
||||
.detect_io_level = TCFG_SD1_DET_IO_LEVEL, // 0:低电平检测到卡。 1:高电平检测到卡
|
||||
.detect_func = sdmmc_0_clk_detect, // 库函数,需要detect_io_level元素作为参数。可以自行重写一个检测函数,在线返回1,不在线返回0,即可。
|
||||
.power = sd_set_power, // 库函数,使用SDPG引脚。可以自行重写其他的SD卡电源控制函数,传入0:关电源。传入1,开电源。如果电源硬件已固定不可控,则该函数无效,可以填NULL
|
||||
/* .power = NULL, */
|
||||
#else
|
||||
.detect_func = sdmmc_cmd_detect,
|
||||
.power = NULL,//cmd检测需要全程供电,建议用硬件固定电源。当然,可以自行写其他的SD卡电源控制函数,传入0:关电源。传入1,开电源。
|
||||
/* .power = sd_set_power, */
|
||||
.power = NULL, // cmd检测需要全程供电,建议用硬件固定电源。当然,可以自行写其他的SD卡电源控制函数,传入0:关电源。传入1,开电源。
|
||||
/* .power = sd_set_power, */`
|
||||
#endif
|
||||
SD1_PLATFORM_DATA_END()
|
||||
SD1_PLATFORM_DATA_END()
|
||||
#endif
|
||||
|
||||
/************************** CHARGE config****************************/
|
||||
#if TCFG_CHARGE_ENABLE
|
||||
CHARGE_PLATFORM_DATA_BEGIN(charge_data)
|
||||
.charge_en = TCFG_CHARGE_ENABLE, //内置充电使能
|
||||
.charge_poweron_en = TCFG_CHARGE_POWERON_ENABLE, //是否支持充电开机
|
||||
.charge_full_V = TCFG_CHARGE_FULL_V, //充电截止电压
|
||||
.charge_full_mA = TCFG_CHARGE_FULL_MA, //充电截止电流
|
||||
.charge_mA = TCFG_CHARGE_MA, //充电电流
|
||||
/*ldo5v拔出过滤值,过滤时间 = (filter*2 + 20)ms,ldoin<0.6V且时间大于过滤时间才认为拔出
|
||||
CHARGE_PLATFORM_DATA_BEGIN(charge_data)
|
||||
.charge_en = TCFG_CHARGE_ENABLE, // 内置充电使能
|
||||
.charge_poweron_en = TCFG_CHARGE_POWERON_ENABLE, // 是否支持充电开机
|
||||
.charge_full_V = TCFG_CHARGE_FULL_V, // 充电截止电压
|
||||
.charge_full_mA = TCFG_CHARGE_FULL_MA, // 充电截止电流
|
||||
.charge_mA = TCFG_CHARGE_MA, // 充电电流
|
||||
/*ldo5v拔出过滤值,过滤时间 = (filter*2 + 20)ms,ldoin<0.6V且时间大于过滤时间才认为拔出
|
||||
对于充满直接从5V掉到0V的充电仓,该值必须设置成0,对于充满由5V先掉到0V之后再升压到xV的
|
||||
充电仓,需要根据实际情况设置该值大小*/
|
||||
.ldo5v_off_filter = 0,
|
||||
/*ldo5v的10k下拉电阻使能,若充电舱需要更大的负载才能检测到插入时,请将该变量置1,默认值设置为1
|
||||
/*ldo5v的10k下拉电阻使能,若充电舱需要更大的负载才能检测到插入时,请将该变量置1,默认值设置为1
|
||||
对于充电舱需要按键升压,且维持电压是从充电舱经过上拉电阻到充电口的舱,请将该值改为0*/
|
||||
.ldo5v_pulldown_en = 0,
|
||||
CHARGE_PLATFORM_DATA_END()
|
||||
#endif//TCFG_CHARGE_ENABLE
|
||||
|
||||
CHARGE_PLATFORM_DATA_END()
|
||||
#endif // TCFG_CHARGE_ENABLE
|
||||
|
||||
#if TCFG_IIS_ENABLE
|
||||
ALINK_PARM alink_param = {
|
||||
//portA: MCLK:PA2 SCLK:PA3 LRCK:PA4 CH0:PA0 CH1:PA1 CH2:PA5 CH3:PA6
|
||||
//portB: MCLK:PC2 SCLK:PA5 LRCK:PA6 CH0:PA0 CH1:PA2 CH2:PA3 CH3:PA4
|
||||
ALINK_PARM alink_param = {
|
||||
// portA: MCLK:PA2 SCLK:PA3 LRCK:PA4 CH0:PA0 CH1:PA1 CH2:PA5 CH3:PA6
|
||||
// portB: MCLK:PC2 SCLK:PA5 LRCK:PA6 CH0:PA0 CH1:PA2 CH2:PA3 CH3:PA4
|
||||
.port_select = TCFG_IIS_OUTPUT_PORTA,
|
||||
.ch_cfg[0].enable = 1,
|
||||
.ch_cfg[2].enable = 1,
|
||||
@ -190,13 +190,12 @@ ALINK_PARM alink_param = {
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/************************** DAC ****************************/
|
||||
#if TCFG_AUDIO_DAC_ENABLE
|
||||
struct dac_platform_data dac_data = {
|
||||
.ldo_volt = TCFG_AUDIO_DAC_LDO_VOLT, //DACVDD等级.需要根据具体硬件来设置(高低压)可选:1.2V/1.3V/2.35V/2.5V/2.65V/2.8V/2.95V/3.1V
|
||||
.vcmo_en = 1, //是否打开VCOMO
|
||||
.output = TCFG_AUDIO_DAC_CONNECT_MODE, //DAC输出配置,和具体硬件连接有关,需根据硬件来设置
|
||||
.ldo_volt = TCFG_AUDIO_DAC_LDO_VOLT, // DACVDD等级.需要根据具体硬件来设置(高低压)可选:1.2V/1.3V/2.35V/2.5V/2.65V/2.8V/2.95V/3.1V
|
||||
.vcmo_en = 1, // 是否打开VCOMO
|
||||
.output = TCFG_AUDIO_DAC_CONNECT_MODE, // DAC输出配置,和具体硬件连接有关,需根据硬件来设置
|
||||
.ldo_isel = 3,
|
||||
.ldo_fb_isel = 3,
|
||||
.lpf_isel = 0x8,
|
||||
@ -207,33 +206,35 @@ struct dac_platform_data dac_data = {
|
||||
/************************** ADC ****************************/
|
||||
#if TCFG_AUDIO_ADC_ENABLE
|
||||
const struct ladc_port ladc_list[] = {
|
||||
{// 0
|
||||
{
|
||||
// 0
|
||||
.channel = TCFG_AUDIO_ADC_LINE_CHA0,
|
||||
},
|
||||
{// 1
|
||||
{
|
||||
// 1
|
||||
.channel = TCFG_AUDIO_ADC_LINE_CHA1,
|
||||
},
|
||||
// total must < 4
|
||||
};
|
||||
struct adc_platform_data adc_data = {
|
||||
.mic_channel = TCFG_AUDIO_ADC_MIC_CHA, //MIC通道选择,对于693x,MIC只有一个通道,固定选择右声道
|
||||
/*MIC LDO电流档位设置:
|
||||
.mic_channel = TCFG_AUDIO_ADC_MIC_CHA, // MIC通道选择,对于693x,MIC只有一个通道,固定选择右声道
|
||||
/*MIC LDO电流档位设置:
|
||||
0:0.625ua 1:1.25ua 2:1.875ua 3:2.5ua*/
|
||||
.mic_ldo_isel = TCFG_AUDIO_ADC_LDO_SEL,
|
||||
/*MIC 是否省隔直电容:
|
||||
/*MIC 是否省隔直电容:
|
||||
0: 不省电容 1: 省电容 */
|
||||
.mic_capless = TCFG_MIC_CAPLESS_ENABLE,
|
||||
/*MIC内部上拉电阻挡位配置,影响MIC的偏置电压
|
||||
/*MIC内部上拉电阻挡位配置,影响MIC的偏置电压
|
||||
(G版后的芯片省电容方式这个配置有效, 隔直模式配置这个参数无效,固定为3k, 使用 mic bias 供电硬件最好预留电阻位)
|
||||
21:1.18K 20:1.42K 19:1.55K 18:1.99K 17:2.2K 16:2.4K 15:2.6K 14:2.91K 13:3.05K 12:3.5K 11:3.73K
|
||||
10:3.91K 9:4.41K 8:5.0K 7:5.6K 6:6K 5:6.5K 4:7K 3:7.6K 2:8.0K 1:8.5K */
|
||||
.mic_bias_res = 16,
|
||||
/*MIC LDO电压档位设置,也会影响MIC的偏置电压
|
||||
/*MIC LDO电压档位设置,也会影响MIC的偏置电压
|
||||
0:2.3v 1:2.5v 2:2.7v 3:3.0v */
|
||||
.mic_ldo_vsel = 2,
|
||||
/*MIC电容隔直模式使用内部mic偏置(PA2)*/
|
||||
.mic_bias_inside = 1,
|
||||
/*保持内部mic偏置输出*/
|
||||
/*MIC电容隔直模式使用内部mic偏置(PA2)*/
|
||||
.mic_bias_inside = 0,
|
||||
/*保持内部mic偏置输出*/
|
||||
.mic_bias_keep = 0,
|
||||
|
||||
// ladc 通道
|
||||
@ -244,26 +245,25 @@ struct adc_platform_data adc_data = {
|
||||
|
||||
/* struct audio_pf_data audio_pf_d = { */
|
||||
/* #if TCFG_AUDIO_DAC_ENABLE */
|
||||
/* .adc_pf_data = &adc_data, */
|
||||
/* .adc_pf_data = &adc_data, */
|
||||
/* #endif */
|
||||
|
||||
/* #if TCFG_AUDIO_ADC_ENABLE */
|
||||
/* .dac_pf_data = &dac_data, */
|
||||
/* .dac_pf_data = &dac_data, */
|
||||
/* #endif */
|
||||
/* }; */
|
||||
|
||||
/* struct audio_platform_data audio_data = { */
|
||||
/* .private_data = (void *) &audio_pf_d, */
|
||||
/* .private_data = (void *) &audio_pf_d, */
|
||||
/* }; */
|
||||
|
||||
|
||||
/************************** IO KEY ****************************/
|
||||
#if TCFG_IOKEY_ENABLE
|
||||
const struct iokey_port iokey_list[] = {
|
||||
{
|
||||
.connect_way = TCFG_IOKEY_POWER_CONNECT_WAY, //IO按键的连接方式
|
||||
.key_type.one_io.port = TCFG_IOKEY_POWER_ONE_PORT, //IO按键对应的引脚
|
||||
.key_value = 0, //按键值
|
||||
.connect_way = TCFG_IOKEY_POWER_CONNECT_WAY, // IO按键的连接方式
|
||||
.key_type.one_io.port = TCFG_IOKEY_POWER_ONE_PORT, // IO按键对应的引脚
|
||||
.key_value = 0, // 按键值
|
||||
},
|
||||
|
||||
{
|
||||
@ -279,16 +279,16 @@ const struct iokey_port iokey_list[] = {
|
||||
},
|
||||
};
|
||||
const struct iokey_platform_data iokey_data = {
|
||||
.enable = TCFG_IOKEY_ENABLE, //是否使能IO按键
|
||||
.num = ARRAY_SIZE(iokey_list), //IO按键的个数
|
||||
.port = iokey_list, //IO按键参数表
|
||||
.enable = TCFG_IOKEY_ENABLE, // 是否使能IO按键
|
||||
.num = ARRAY_SIZE(iokey_list), // IO按键的个数
|
||||
.port = iokey_list, // IO按键参数表
|
||||
};
|
||||
|
||||
#if MULT_KEY_ENABLE
|
||||
//组合按键消息映射表
|
||||
//配置注意事项:单个按键按键值需要按照顺序编号,如power:0, prev:1, next:2
|
||||
//bit_value = BIT(0) | BIT(1) 指按键值为0和按键值为1的两个按键被同时按下,
|
||||
//remap_value = 3指当这两个按键被同时按下后重新映射的按键值;
|
||||
// 组合按键消息映射表
|
||||
// 配置注意事项:单个按键按键值需要按照顺序编号,如power:0, prev:1, next:2
|
||||
// bit_value = BIT(0) | BIT(1) 指按键值为0和按键值为1的两个按键被同时按下,
|
||||
// remap_value = 3指当这两个按键被同时按下后重新映射的按键值;
|
||||
const struct key_remap iokey_remap_table[] = {
|
||||
{.bit_value = BIT(0) | BIT(1), .remap_value = 3},
|
||||
{.bit_value = BIT(0) | BIT(2), .remap_value = 4},
|
||||
@ -306,11 +306,12 @@ const struct key_remap_data iokey_remap_data = {
|
||||
/************************** AD KEY ****************************/
|
||||
#if TCFG_ADKEY_ENABLE
|
||||
const struct adkey_platform_data adkey_data = {
|
||||
.enable = TCFG_ADKEY_ENABLE, //AD按键使能
|
||||
.adkey_pin = TCFG_ADKEY_PORT, //AD按键对应引脚
|
||||
.ad_channel = TCFG_ADKEY_AD_CHANNEL, //AD通道值
|
||||
.extern_up_en = TCFG_ADKEY_EXTERN_UP_ENABLE, //是否使用外接上拉电阻
|
||||
.ad_value = { //根据电阻算出来的电压值
|
||||
.enable = TCFG_ADKEY_ENABLE, // AD按键使能
|
||||
.adkey_pin = TCFG_ADKEY_PORT, // AD按键对应引脚
|
||||
.ad_channel = TCFG_ADKEY_AD_CHANNEL, // AD通道值
|
||||
.extern_up_en = TCFG_ADKEY_EXTERN_UP_ENABLE, // 是否使用外接上拉电阻
|
||||
.ad_value = {
|
||||
// 根据电阻算出来的电压值
|
||||
TCFG_ADKEY_VOLTAGE0,
|
||||
TCFG_ADKEY_VOLTAGE1,
|
||||
TCFG_ADKEY_VOLTAGE2,
|
||||
@ -322,7 +323,8 @@ const struct adkey_platform_data adkey_data = {
|
||||
TCFG_ADKEY_VOLTAGE8,
|
||||
TCFG_ADKEY_VOLTAGE9,
|
||||
},
|
||||
.key_value = { //AD按键各个按键的键值
|
||||
.key_value = {
|
||||
// AD按键各个按键的键值
|
||||
TCFG_ADKEY_VALUE0,
|
||||
TCFG_ADKEY_VALUE1,
|
||||
TCFG_ADKEY_VALUE2,
|
||||
@ -337,27 +339,25 @@ const struct adkey_platform_data adkey_data = {
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/************************** IR KEY ****************************/
|
||||
#if TCFG_IRKEY_ENABLE
|
||||
const struct irkey_platform_data irkey_data = {
|
||||
.enable = TCFG_IRKEY_ENABLE, //IR按键使能
|
||||
.port = TCFG_IRKEY_PORT, //IR按键口
|
||||
.enable = TCFG_IRKEY_ENABLE, // IR按键使能
|
||||
.port = TCFG_IRKEY_PORT, // IR按键口
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/************************** TOUCH_KEY ****************************/
|
||||
#if TCFG_TOUCH_KEY_ENABLE
|
||||
const struct touch_key_port touch_key_list[] = {
|
||||
{
|
||||
.port = TCFG_TOUCH_KEY0_PORT,
|
||||
.key_value = TCFG_TOUCH_KEY0_VALUE, //该值由时钟配置和硬件结构决定, 需要调试
|
||||
.key_value = TCFG_TOUCH_KEY0_VALUE, // 该值由时钟配置和硬件结构决定, 需要调试
|
||||
},
|
||||
|
||||
{
|
||||
.port = TCFG_TOUCH_KEY1_PORT,
|
||||
.key_value = TCFG_TOUCH_KEY1_VALUE, //该值由时钟配置和硬件结构决定, 需要调试
|
||||
.key_value = TCFG_TOUCH_KEY1_VALUE, // 该值由时钟配置和硬件结构决定, 需要调试
|
||||
},
|
||||
};
|
||||
|
||||
@ -408,7 +408,7 @@ struct linein_dev_data linein_data = {
|
||||
#if TCFG_RDEC_KEY_ENABLE
|
||||
const struct rdec_device rdeckey_list[] = {
|
||||
{
|
||||
.index = RDEC0 ,
|
||||
.index = RDEC0,
|
||||
.sin_port0 = TCFG_RDEC0_ECODE1_PORT,
|
||||
.sin_port1 = TCFG_RDEC0_ECODE2_PORT,
|
||||
.key_value0 = TCFG_RDEC0_KEY0_VALUE | BIT(7),
|
||||
@ -416,7 +416,7 @@ const struct rdec_device rdeckey_list[] = {
|
||||
},
|
||||
|
||||
{
|
||||
.index = RDEC1 ,
|
||||
.index = RDEC1,
|
||||
.sin_port0 = TCFG_RDEC1_ECODE1_PORT,
|
||||
.sin_port1 = TCFG_RDEC1_ECODE2_PORT,
|
||||
.key_value0 = TCFG_RDEC1_KEY0_VALUE | BIT(7),
|
||||
@ -424,19 +424,18 @@ const struct rdec_device rdeckey_list[] = {
|
||||
},
|
||||
|
||||
{
|
||||
.index = RDEC2 ,
|
||||
.index = RDEC2,
|
||||
.sin_port0 = TCFG_RDEC2_ECODE1_PORT,
|
||||
.sin_port1 = TCFG_RDEC2_ECODE2_PORT,
|
||||
.key_value0 = TCFG_RDEC2_KEY0_VALUE | BIT(7),
|
||||
.key_value1 = TCFG_RDEC2_KEY1_VALUE | BIT(7),
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
const struct rdec_platform_data rdec_key_data = {
|
||||
.enable = 1, //TCFG_RDEC_KEY_ENABLE, //是否使能RDEC按键
|
||||
.num = ARRAY_SIZE(rdeckey_list), //RDEC按键的个数
|
||||
.rdec = rdeckey_list, //RDEC按键参数表
|
||||
.enable = 1, // TCFG_RDEC_KEY_ENABLE, //是否使能RDEC按键
|
||||
.num = ARRAY_SIZE(rdeckey_list), // RDEC按键的个数
|
||||
.rdec = rdeckey_list, // RDEC按键参数表
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -457,15 +456,14 @@ struct otg_dev_data otg_data = {
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/************************** rtc ****************************/
|
||||
|
||||
#if TCFG_RTC_ENABLE
|
||||
const struct rtc_dev_data rtc_data = {
|
||||
.port = (u8)-1,
|
||||
.edge = 0, //0 leading edge, 1 falling edge
|
||||
.edge = 0, // 0 leading edge, 1 falling edge
|
||||
.port_en = false,
|
||||
.rtc_ldo = false,//使用内部ldo 供电
|
||||
.rtc_ldo = false, // 使用内部ldo 供电
|
||||
.clk_res = RTC_CLK_RES_SEL,
|
||||
};
|
||||
#endif
|
||||
@ -473,14 +471,13 @@ const struct rtc_dev_data rtc_data = {
|
||||
/************************** PWM_LED ****************************/
|
||||
#if TCFG_PWMLED_ENABLE
|
||||
LED_PLATFORM_DATA_BEGIN(pwm_led_data)
|
||||
.io_mode = TCFG_PWMLED_IOMODE, //推灯模式设置:支持单个IO推两个灯和两个IO推两个灯
|
||||
.io_cfg.one_io.pin = TCFG_PWMLED_PIN, //单个IO推两个灯的IO口配置
|
||||
LED_PLATFORM_DATA_END()
|
||||
.io_mode = TCFG_PWMLED_IOMODE, // 推灯模式设置:支持单个IO推两个灯和两个IO推两个灯
|
||||
.io_cfg.one_io.pin = TCFG_PWMLED_PIN, // 单个IO推两个灯的IO口配置
|
||||
LED_PLATFORM_DATA_END()
|
||||
#endif
|
||||
|
||||
|
||||
#if TCFG_UI_LED7_ENABLE
|
||||
LED7_PLATFORM_DATA_BEGIN(led7_data)
|
||||
LED7_PLATFORM_DATA_BEGIN(led7_data)
|
||||
.pin_type = LED7_PIN7,
|
||||
.pin_cfg.pin7.pin[0] = IO_PORTC_01,
|
||||
.pin_cfg.pin7.pin[1] = IO_PORTC_02,
|
||||
@ -489,9 +486,9 @@ LED7_PLATFORM_DATA_BEGIN(led7_data)
|
||||
.pin_cfg.pin7.pin[4] = IO_PORTC_05,
|
||||
.pin_cfg.pin7.pin[5] = IO_PORTB_06,
|
||||
.pin_cfg.pin7.pin[6] = IO_PORTB_07,
|
||||
LED7_PLATFORM_DATA_END()
|
||||
LED7_PLATFORM_DATA_END()
|
||||
|
||||
const struct ui_devices_cfg ui_cfg_data = {
|
||||
const struct ui_devices_cfg ui_cfg_data = {
|
||||
.type = LED_7,
|
||||
.private_data = (void *)&led7_data,
|
||||
};
|
||||
@ -506,16 +503,15 @@ LED7_PLATFORM_DATA_BEGIN(led7_data)
|
||||
.pin_cfg.pin7.pin[3] = IO_PORTB_03,
|
||||
.pin_cfg.pin7.pin[4] = IO_PORTB_04,
|
||||
.pin_cfg.pin7.pin[5] = IO_PORTB_05,
|
||||
.pin_cfg.pin7.pin[6] = (u8)-1,//IO_PORTB_06,
|
||||
LED7_PLATFORM_DATA_END()
|
||||
.pin_cfg.pin7.pin[6] = (u8)-1, // IO_PORTB_06,
|
||||
LED7_PLATFORM_DATA_END()
|
||||
|
||||
const struct ui_devices_cfg ui_cfg_data = {
|
||||
const struct ui_devices_cfg ui_cfg_data = {
|
||||
.type = LED_7,
|
||||
.private_data = (void *)&led7_data,
|
||||
};
|
||||
#endif /* #if TCFG_UI_LED7_ENABLE */
|
||||
|
||||
|
||||
#if TCFG_UI_LCD_SEG3X9_ENABLE
|
||||
LCD_SEG3X9_PLATFORM_DATA_BEGIN(lcd_seg3x9_data)
|
||||
.vlcd = LCD_SEG3X9_VOLTAGE_3_3V,
|
||||
@ -533,9 +529,9 @@ LCD_SEG3X9_PLATFORM_DATA_BEGIN(lcd_seg3x9_data)
|
||||
.pin_cfg.pin_seg[6] = IO_PORTA_12,
|
||||
.pin_cfg.pin_seg[7] = IO_PORTA_10,
|
||||
.pin_cfg.pin_seg[8] = IO_PORTA_09,
|
||||
LCD_SEG3X9_PLATFORM_DATA_END()
|
||||
LCD_SEG3X9_PLATFORM_DATA_END()
|
||||
|
||||
const struct ui_devices_cfg ui_cfg_data = {
|
||||
const struct ui_devices_cfg ui_cfg_data = {
|
||||
.type = LCD_SEG3X9,
|
||||
.private_data = (void *)&lcd_seg3x9_data,
|
||||
};
|
||||
@ -544,12 +540,12 @@ const struct ui_devices_cfg ui_cfg_data = {
|
||||
|
||||
#if TCHFG_SOFT_I2C_ENABLE
|
||||
const struct soft_iic_config soft_iic_cfg[] = {
|
||||
//iic0 data
|
||||
// iic0 data
|
||||
{
|
||||
.scl = TCFG_SW_I2C0_CLK_PORT, //IIC CLK脚
|
||||
.sda = TCFG_SW_I2C0_DAT_PORT, //IIC DAT脚
|
||||
.delay = TCFG_SW_I2C0_DELAY_CNT, //软件IIC延时参数,影响通讯时钟频率
|
||||
.io_pu = 1, //是否打开上拉电阻,如果外部电路没有焊接上拉电阻需要置1
|
||||
.scl = TCFG_SW_I2C0_CLK_PORT, // IIC CLK脚
|
||||
.sda = TCFG_SW_I2C0_DAT_PORT, // IIC DAT脚
|
||||
.delay = TCFG_SW_I2C0_DELAY_CNT, // 软件IIC延时参数,影响通讯时钟频率
|
||||
.io_pu = 1, // 是否打开上拉电阻,如果外部电路没有焊接上拉电阻需要置1
|
||||
},
|
||||
#if 0
|
||||
//iic1 data
|
||||
@ -565,7 +561,7 @@ const struct soft_iic_config soft_iic_cfg[] = {
|
||||
|
||||
#if TCHFG_HW_I2C_ENABLE
|
||||
const struct hw_iic_config hw_iic_cfg[] = {
|
||||
//iic0 data
|
||||
// iic0 data
|
||||
{
|
||||
/*硬件IIC端口下选择
|
||||
SCL SDA
|
||||
@ -575,15 +571,14 @@ const struct hw_iic_config hw_iic_cfg[] = {
|
||||
'D': IO_PORTA_05 IO_PORTA_06
|
||||
*/
|
||||
.port = TCFG_HW_I2C0_PORTS,
|
||||
.baudrate = TCFG_HW_I2C0_CLK, //IIC通讯波特率
|
||||
.hdrive = 0, //是否打开IO口强驱
|
||||
.io_filter = 1, //是否打开滤波器(去纹波)
|
||||
.io_pu = 1, //是否打开上拉电阻,如果外部电路没有焊接上拉电阻需要置1
|
||||
.baudrate = TCFG_HW_I2C0_CLK, // IIC通讯波特率
|
||||
.hdrive = 0, // 是否打开IO口强驱
|
||||
.io_filter = 1, // 是否打开滤波器(去纹波)
|
||||
.io_pu = 1, // 是否打开上拉电阻,如果外部电路没有焊接上拉电阻需要置1
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#if TCFG_HW_SPI1_ENABLE
|
||||
const struct spi_platform_data spi1_p_data = {
|
||||
.port = TCFG_HW_SPI1_PORT,
|
||||
@ -612,12 +607,12 @@ NORFLASH_DEV_PLATFORM_DATA_BEGIN(norflash_fat_dev_data)
|
||||
.spi_pdata = &spi2_p_data,
|
||||
#endif
|
||||
.start_addr = 0,
|
||||
.size = 1*1024*1024,
|
||||
NORFLASH_DEV_PLATFORM_DATA_END()
|
||||
.size = 1 * 1024 * 1024,
|
||||
NORFLASH_DEV_PLATFORM_DATA_END()
|
||||
#endif
|
||||
|
||||
#if TCFG_NOR_FS
|
||||
NORFLASH_DEV_PLATFORM_DATA_BEGIN(norflash_norfs_dev_data)
|
||||
NORFLASH_DEV_PLATFORM_DATA_BEGIN(norflash_norfs_dev_data)
|
||||
.spi_hw_num = TCFG_FLASH_DEV_SPI_HW_NUM,
|
||||
.spi_cs_port = TCFG_FLASH_DEV_SPI_CS_PORT,
|
||||
#if (TCFG_FLASH_DEV_SPI_HW_NUM == 1)
|
||||
@ -627,12 +622,12 @@ NORFLASH_DEV_PLATFORM_DATA_BEGIN(norflash_norfs_dev_data)
|
||||
#endif
|
||||
/* .start_addr = 1*1024*1024, */
|
||||
.start_addr = 0,
|
||||
.size = 4*1024*1024,
|
||||
NORFLASH_DEV_PLATFORM_DATA_END()
|
||||
.size = 4 * 1024 * 1024,
|
||||
NORFLASH_DEV_PLATFORM_DATA_END()
|
||||
#endif
|
||||
|
||||
#if TCFG_NOR_REC
|
||||
NORFLASH_DEV_PLATFORM_DATA_BEGIN(norflash_norfs_rec_dev_data)
|
||||
NORFLASH_DEV_PLATFORM_DATA_BEGIN(norflash_norfs_rec_dev_data)
|
||||
.spi_hw_num = TCFG_FLASH_DEV_SPI_HW_NUM,
|
||||
.spi_cs_port = TCFG_FLASH_DEV_SPI_CS_PORT,
|
||||
#if (TCFG_FLASH_DEV_SPI_HW_NUM == 1)
|
||||
@ -640,15 +635,13 @@ NORFLASH_DEV_PLATFORM_DATA_BEGIN(norflash_norfs_rec_dev_data)
|
||||
#elif (TCFG_FLASH_DEV_SPI_HW_NUM == 2)
|
||||
.spi_pdata = &spi2_p_data,
|
||||
#endif
|
||||
.start_addr = 2*1024*1024,
|
||||
.size = 2*1024*1024,
|
||||
NORFLASH_DEV_PLATFORM_DATA_END()
|
||||
.start_addr = 2 * 1024 * 1024,
|
||||
.size = 2 * 1024 * 1024,
|
||||
NORFLASH_DEV_PLATFORM_DATA_END()
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if TCFG_SPI_LCD_ENABLE
|
||||
LCD_SPI_PLATFORM_DATA_BEGIN(lcd_spi_data)
|
||||
LCD_SPI_PLATFORM_DATA_BEGIN(lcd_spi_data)
|
||||
.pin_reset = -1,
|
||||
.pin_cs = IO_PORTA_00,
|
||||
.pin_rs = IO_PORTA_01,
|
||||
@ -662,16 +655,14 @@ LCD_SPI_PLATFORM_DATA_BEGIN(lcd_spi_data)
|
||||
.spi_pdata = &spi2_p_data,
|
||||
#endif
|
||||
|
||||
LED7_PLATFORM_DATA_END()
|
||||
LED7_PLATFORM_DATA_END()
|
||||
|
||||
const struct ui_devices_cfg ui_cfg_data = {
|
||||
const struct ui_devices_cfg ui_cfg_data = {
|
||||
.type = TFT_LCD,
|
||||
.private_data = (void *)&lcd_spi_data,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if TCFG_GSENSOR_ENABLE
|
||||
#if TCFG_DA230_EN
|
||||
|
||||
@ -679,98 +670,96 @@ GSENSOR_PLATFORM_DATA_BEGIN(gSensor_data)
|
||||
.iic = 0,
|
||||
.gSensor_name = "da230",
|
||||
.gSensor_int_io = IO_PORTB_08,
|
||||
GSENSOR_PLATFORM_DATA_END();
|
||||
#endif //end if DA230_EN
|
||||
#endif //end if CONFIG_GSENSOR_ENABLE
|
||||
GSENSOR_PLATFORM_DATA_END();
|
||||
#endif // end if DA230_EN
|
||||
#endif // end if CONFIG_GSENSOR_ENABLE
|
||||
|
||||
#if TCFG_FM_ENABLE
|
||||
|
||||
FM_DEV_PLATFORM_DATA_BEGIN(fm_dev_data)
|
||||
.iic_hdl = 0,
|
||||
.iic_delay = 50,
|
||||
FM_DEV_PLATFORM_DATA_END();
|
||||
FM_DEV_PLATFORM_DATA_END();
|
||||
|
||||
#endif
|
||||
|
||||
extern const struct device_operations mass_storage_ops;
|
||||
REGISTER_DEVICES(device_table) = {
|
||||
/* { "audio", &audio_dev_ops, (void *) &audio_data }, */
|
||||
/* { "audio", &audio_dev_ops, (void *) &audio_data }, */
|
||||
|
||||
/* #if TCFG_CHARGE_ENABLE */
|
||||
/* { "charge", &charge_dev_ops, (void *)&charge_data }, */
|
||||
/* #endif */
|
||||
|
||||
#if TCFG_VIRFAT_FLASH_ENABLE
|
||||
{ "virfat_flash", &virfat_flash_dev_ops, (void *)"res_nor"},
|
||||
{"virfat_flash", &virfat_flash_dev_ops, (void *)"res_nor"},
|
||||
#endif
|
||||
|
||||
#if TCFG_SD0_ENABLE
|
||||
{ "sd0", &sd_dev_ops, (void *) &sd0_data},
|
||||
{"sd0", &sd_dev_ops, (void *)&sd0_data},
|
||||
#endif
|
||||
|
||||
#if TCFG_SD1_ENABLE
|
||||
{ "sd1", &sd_dev_ops, (void *) &sd1_data},
|
||||
{"sd1", &sd_dev_ops, (void *)&sd1_data},
|
||||
#endif
|
||||
|
||||
#if TCFG_LINEIN_ENABLE
|
||||
{ "linein", &linein_dev_ops, (void *)&linein_data},
|
||||
{"linein", &linein_dev_ops, (void *)&linein_data},
|
||||
#endif
|
||||
#if TCFG_OTG_MODE
|
||||
{ "otg", &usb_dev_ops, (void *) &otg_data},
|
||||
{"otg", &usb_dev_ops, (void *)&otg_data},
|
||||
#endif
|
||||
#if TCFG_UDISK_ENABLE
|
||||
{ "udisk0", &mass_storage_ops , NULL},
|
||||
{"udisk0", &mass_storage_ops, NULL},
|
||||
#endif
|
||||
#if TCFG_RTC_ENABLE
|
||||
#if TCFG_USE_VIRTUAL_RTC
|
||||
{ "rtc", &rtc_simulate_ops , (void *)&rtc_data},
|
||||
{"rtc", &rtc_simulate_ops, (void *)&rtc_data},
|
||||
#else
|
||||
{ "rtc", &rtc_dev_ops , (void *)&rtc_data},
|
||||
{"rtc", &rtc_dev_ops, (void *)&rtc_data},
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TCFG_NORFLASH_DEV_ENABLE
|
||||
#if TCFG_NOR_FAT
|
||||
{ "fat_nor", &norflash_dev_ops , (void *)&norflash_fat_dev_data},
|
||||
{"fat_nor", &norflash_dev_ops, (void *)&norflash_fat_dev_data},
|
||||
#endif
|
||||
|
||||
#if TCFG_NOR_FS
|
||||
{ "res_nor", &norfs_dev_ops , (void *)&norflash_norfs_dev_data},
|
||||
{"res_nor", &norfs_dev_ops, (void *)&norflash_norfs_dev_data},
|
||||
#endif
|
||||
|
||||
#if TCFG_NOR_REC
|
||||
{"rec_nor", &norfs_dev_ops , (void *)&norflash_norfs_rec_dev_data},
|
||||
{"rec_nor", &norfs_dev_ops, (void *)&norflash_norfs_rec_dev_data},
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
/************************** LOW POWER config ****************************/
|
||||
const struct low_power_param power_param = {
|
||||
.config = TCFG_LOWPOWER_LOWPOWER_SEL, //0:sniff时芯片不进入低功耗 1:sniff时芯片进入powerdown
|
||||
.btosc_hz = TCFG_CLOCK_OSC_HZ, //外接晶振频率
|
||||
.delay_us = TCFG_CLOCK_SYS_HZ / 1000000L, //提供给低功耗模块的延时(不需要需修改)
|
||||
.btosc_disable = TCFG_LOWPOWER_BTOSC_DISABLE, //进入低功耗时BTOSC是否保持
|
||||
.vddiom_lev = TCFG_LOWPOWER_VDDIOM_LEVEL, //强VDDIO等级,可选:2.0V 2.2V 2.4V 2.6V 2.8V 3.0V 3.2V 3.6V
|
||||
.vddiow_lev = TCFG_LOWPOWER_VDDIOW_LEVEL, //弱VDDIO等级,可选:2.1V 2.4V 2.8V 3.2V
|
||||
.osc_type = OSC_TYPE_BT_OSC ,
|
||||
/* .osc_type = OSC_TYPE_LRC , */
|
||||
.config = TCFG_LOWPOWER_LOWPOWER_SEL, // 0:sniff时芯片不进入低功耗 1:sniff时芯片进入powerdown
|
||||
.btosc_hz = TCFG_CLOCK_OSC_HZ, // 外接晶振频率
|
||||
.delay_us = TCFG_CLOCK_SYS_HZ / 1000000L, // 提供给低功耗模块的延时(不需要需修改)
|
||||
.btosc_disable = TCFG_LOWPOWER_BTOSC_DISABLE, // 进入低功耗时BTOSC是否保持
|
||||
.vddiom_lev = TCFG_LOWPOWER_VDDIOM_LEVEL, // 强VDDIO等级,可选:2.0V 2.2V 2.4V 2.6V 2.8V 3.0V 3.2V 3.6V
|
||||
.vddiow_lev = TCFG_LOWPOWER_VDDIOW_LEVEL, // 弱VDDIO等级,可选:2.1V 2.4V 2.8V 3.2V
|
||||
.osc_type = OSC_TYPE_BT_OSC,
|
||||
/* .osc_type = OSC_TYPE_LRC , */
|
||||
#if TCFG_USE_VIRTUAL_RTC
|
||||
.virtual_rtc = 1,
|
||||
.vir_rtc_trim_time = 0, //单位:秒(s)
|
||||
.vir_rtc_trim_time = 0, // 单位:秒(s)
|
||||
#else
|
||||
.user_nv_timer_en = 0,
|
||||
#endif
|
||||
.nv_timer_interval = 500, //ms,lp_timer中断间隔
|
||||
.nv_timer_interval = 500, // ms,lp_timer中断间隔
|
||||
};
|
||||
|
||||
|
||||
|
||||
/************************** PWR config ****************************/
|
||||
struct port_wakeup port0 = {
|
||||
.pullup_down_enable = ENABLE, //配置I/O 内部上下拉是否使能
|
||||
.edge = FALLING_EDGE, //唤醒方式选择,可选:上升沿\下降沿
|
||||
.attribute = BLUETOOTH_RESUME, //保留参数
|
||||
.iomap = IO_PORTA_06, //唤醒口选择
|
||||
.pullup_down_enable = ENABLE, // 配置I/O 内部上下拉是否使能
|
||||
.edge = FALLING_EDGE, // 唤醒方式选择,可选:上升沿\下降沿
|
||||
.attribute = BLUETOOTH_RESUME, // 保留参数
|
||||
.iomap = IO_PORTB_01, // 唤醒口选择
|
||||
};
|
||||
|
||||
const struct sub_wakeup sub_wkup = {
|
||||
@ -810,15 +799,17 @@ static void key_wakeup_enable()
|
||||
void debug_uart_init(const struct uart_platform_data *data)
|
||||
{
|
||||
#if TCFG_UART0_ENABLE
|
||||
if (data) {
|
||||
if (data)
|
||||
{
|
||||
uart_init(data);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
uart_init(&uart0_data);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
STATUS *get_led_config(void)
|
||||
{
|
||||
return &(__this->led);
|
||||
@ -840,16 +831,20 @@ u8 get_power_on_status(void)
|
||||
struct iokey_port *power_io_list = NULL;
|
||||
power_io_list = iokey_data.port;
|
||||
|
||||
if (iokey_data.enable) {
|
||||
if (gpio_read(power_io_list->key_type.one_io.port) == power_io_list->connect_way){
|
||||
if (iokey_data.enable)
|
||||
{
|
||||
if (gpio_read(power_io_list->key_type.one_io.port) == power_io_list->connect_way)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TCFG_ADKEY_ENABLE
|
||||
if (adkey_data.enable) {
|
||||
if (adc_get_value(adkey_data.ad_channel) < 10) {
|
||||
if (adkey_data.enable)
|
||||
{
|
||||
if (adc_get_value(adkey_data.ad_channel) < 10)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -871,7 +866,7 @@ static void board_devices_init(void)
|
||||
|
||||
#if TCFG_GSENSOR_ENABLE
|
||||
gravity_sensor_init(&gSensor_data);
|
||||
#endif //end if CONFIG_GSENSOR_ENABLE
|
||||
#endif // end if CONFIG_GSENSOR_ENABLE
|
||||
|
||||
#if TCFG_UI_ENABLE
|
||||
UI_INIT(&ui_cfg_data);
|
||||
@ -899,13 +894,14 @@ void board_init()
|
||||
charge_init(NULL, (void *)&charge_data);
|
||||
#endif
|
||||
|
||||
if (!get_charge_online_flag()) {
|
||||
if (!get_charge_online_flag())
|
||||
{
|
||||
check_power_on_voltage();
|
||||
}
|
||||
|
||||
/* #if (TCFG_SD0_ENABLE || TCFG_SD1_ENABLE) */
|
||||
/* sdpg_config(1); */
|
||||
/* #endif */
|
||||
#if (TCFG_SD0_ENABLE || TCFG_SD1_ENABLE) /**/
|
||||
sdpg_config(1); /* */
|
||||
#endif /**/
|
||||
|
||||
#if TCFG_FM_ENABLE
|
||||
fm_dev_init(&fm_dev_data);
|
||||
@ -926,13 +922,16 @@ void board_init()
|
||||
dev_manager_init();
|
||||
board_devices_init();
|
||||
|
||||
if(get_charge_online_flag()){
|
||||
if (get_charge_online_flag())
|
||||
{
|
||||
power_set_mode(PWR_LDO15);
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
power_set_mode(TCFG_LOWPOWER_POWER_SEL);
|
||||
}
|
||||
|
||||
//针对硅mic要输出1给mic供电(按实际使用情况配置)
|
||||
// 针对硅mic要输出1给mic供电(按实际使用情况配置)
|
||||
/* if(!adc_data.mic_capless){ */
|
||||
/* gpio_set_pull_up(IO_PORTA_04, 0); */
|
||||
/* gpio_set_pull_down(IO_PORTA_04, 0); */
|
||||
@ -940,8 +939,9 @@ void board_init()
|
||||
/* gpio_set_output_value(IO_PORTA_04,1); */
|
||||
/* } */
|
||||
|
||||
#if TCFG_UART0_ENABLE
|
||||
if (uart0_data.rx_pin < IO_MAX_NUM) {
|
||||
#if TCFG_UART0_ENABLE
|
||||
if (uart0_data.rx_pin < IO_MAX_NUM)
|
||||
{
|
||||
gpio_set_die(uart0_data.rx_pin, 1);
|
||||
}
|
||||
#endif
|
||||
@ -953,9 +953,6 @@ void board_init()
|
||||
#if TCFG_RTC_ENABLE
|
||||
alarm_init();
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*进软关机之前默认将IO口都设置成高阻状态,需要保留原来状态的请修改该函数*/
|
||||
@ -975,7 +972,7 @@ void board_set_soft_poweroff(void)
|
||||
gpio_die(GPIOA, 0, 16, ~porta_value, GPIO_AND);
|
||||
gpio_dieh(GPIOA, 0, 16, ~porta_value, GPIO_AND);
|
||||
|
||||
//保留长按Reset Pin - PB1
|
||||
// 保留长按Reset Pin - PB1
|
||||
gpio_dir(GPIOB, 1, 15, portb_value, GPIO_OR);
|
||||
gpio_set_pu(GPIOB, 1, 15, ~portb_value, GPIO_AND);
|
||||
gpio_set_pd(GPIOB, 1, 15, ~portb_value, GPIO_AND);
|
||||
@ -999,11 +996,11 @@ void board_set_soft_poweroff(void)
|
||||
sdpg_config(0);
|
||||
#endif
|
||||
|
||||
//dac_power_off();
|
||||
// dac_power_off();
|
||||
}
|
||||
|
||||
#define APP_IO_DEBUG_0(i,x) //{JL_PORT##i->DIR &= ~BIT(x), JL_PORT##i->OUT &= ~BIT(x);}
|
||||
#define APP_IO_DEBUG_1(i,x) //{JL_PORT##i->DIR &= ~BIT(x), JL_PORT##i->OUT |= BIT(x);}
|
||||
#define APP_IO_DEBUG_0(i, x) //{JL_PORT##i->DIR &= ~BIT(x), JL_PORT##i->OUT &= ~BIT(x);}
|
||||
#define APP_IO_DEBUG_1(i, x) //{JL_PORT##i->DIR &= ~BIT(x), JL_PORT##i->OUT |= BIT(x);}
|
||||
|
||||
void sleep_exit_callback(u32 usec)
|
||||
{
|
||||
@ -1015,12 +1012,15 @@ void sleep_exit_callback(u32 usec)
|
||||
void sleep_enter_callback(u8 step)
|
||||
{
|
||||
/* 此函数禁止添加打印 */
|
||||
if (step == 1) {
|
||||
if (step == 1)
|
||||
{
|
||||
/* putchar('<'); */
|
||||
APP_IO_DEBUG_0(A, 6);
|
||||
dac_sniff_power_off();
|
||||
/* dac_power_off(); */
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
key_wakeup_enable();
|
||||
gpio_set_pull_up(IO_PORTA_03, 0);
|
||||
gpio_set_pull_down(IO_PORTA_03, 0);
|
||||
@ -1063,8 +1063,7 @@ void board_power_init(void)
|
||||
.rx = IO_PORTA_02,
|
||||
.tx = IO_PORTA_03,
|
||||
.output_channel = CH1_UT1_TX,
|
||||
.input_channel = INPUT_CH0
|
||||
};
|
||||
.input_channel = INPUT_CH0};
|
||||
uart_update_init(&update_cfg);
|
||||
}
|
||||
#endif
|
||||
@ -1076,13 +1075,16 @@ static void board_power_wakeup_init(void)
|
||||
key_wakeup_disable();
|
||||
#if TCFG_POWER_ON_NEED_KEY
|
||||
extern u8 power_reset_src;
|
||||
if ((power_reset_src & BIT(0)) || (power_reset_src & BIT(1))) {
|
||||
if ((power_reset_src & BIT(0)) || (power_reset_src & BIT(1)))
|
||||
{
|
||||
#if TCFG_CHARGE_ENABLE
|
||||
log_info("is ldo5v wakeup:%d\n",is_ldo5v_wakeup());
|
||||
if (is_ldo5v_wakeup()) {
|
||||
log_info("is ldo5v wakeup:%d\n", is_ldo5v_wakeup());
|
||||
if (is_ldo5v_wakeup())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (get_ldo5v_online_hw()) {
|
||||
if (get_ldo5v_online_hw())
|
||||
{
|
||||
return;
|
||||
}
|
||||
/*LDO5V,检测上升沿,用于检测ldoin插入*/
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define TCFG_APP_FM_EN 1
|
||||
#define TCFG_APP_PC_EN 1
|
||||
#define TCFG_APP_RTC_EN 0
|
||||
#define TCFG_APP_RECORD_EN 1
|
||||
#define TCFG_APP_RECORD_EN 0
|
||||
#define TCFG_APP_SPDIF_EN 0
|
||||
//*********************************************************************************//
|
||||
// PCM_DEBUG调试配置 //
|
||||
@ -41,9 +41,9 @@
|
||||
//*********************************************************************************//
|
||||
// UART配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_UART0_ENABLE ENABLE_THIS_MOUDLE //串口打印模块使能
|
||||
#define TCFG_UART0_ENABLE DISABLE_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 //串口波特率配置
|
||||
|
||||
//*********************************************************************************//
|
||||
@ -69,7 +69,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'
|
||||
@ -77,7 +77,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'
|
||||
@ -97,11 +97,11 @@
|
||||
// 充电参数配置 //
|
||||
//*********************************************************************************//
|
||||
//是否支持芯片内置充电
|
||||
#define TCFG_CHARGE_ENABLE ENABLE_THIS_MOUDLE
|
||||
#define TCFG_CHARGE_ENABLE DISABLE_THIS_MOUDLE
|
||||
//是否支持开机充电
|
||||
#define TCFG_CHARGE_POWERON_ENABLE ENABLE
|
||||
#define TCFG_CHARGE_POWERON_ENABLE DISABLE
|
||||
//是否支持拔出充电自动开机功能
|
||||
#define TCFG_CHARGE_OFF_POWERON_NE ENABLE
|
||||
#define TCFG_CHARGE_OFF_POWERON_NE DISABLE
|
||||
|
||||
#define TCFG_CHARGE_FULL_V CHARGE_FULL_V_4202
|
||||
|
||||
@ -122,7 +122,7 @@
|
||||
//B组IO: CMD:PB6 CLK:PB7 DAT0:PB5 //E组IO: CMD:PA4 CLK:PC5 DAT0:DM
|
||||
//C组IO: CMD:PA4 CLK:PA2 DAT0:PA3 //F组IO: CMD:PB6 CLK:PB7 DAT0:PB4
|
||||
#define TCFG_SD0_ENABLE ENABLE_THIS_MOUDLE
|
||||
#define TCFG_SD0_PORTS 'D'
|
||||
#define TCFG_SD0_PORTS 'F'
|
||||
#define TCFG_SD0_DAT_MODE 1//AC696x不支持4线模式
|
||||
#define TCFG_SD0_DET_MODE SD_CLK_DECT
|
||||
#define TCFG_SD0_DET_IO IO_PORT_DM//当SD_DET_MODE为2时有效
|
||||
@ -133,7 +133,7 @@
|
||||
#if TCFG_SD0_SD1_USE_THE_SAME_HW
|
||||
#define TCFG_SD1_ENABLE 1
|
||||
#else
|
||||
#define TCFG_SD1_ENABLE 0
|
||||
#define TCFG_SD1_ENABLE DISABLE_THIS_MOUDLE
|
||||
#endif
|
||||
#define TCFG_SD1_PORTS 'F'
|
||||
#define TCFG_SD1_DAT_MODE 1//AC696x不支持4线模式
|
||||
@ -238,7 +238,6 @@
|
||||
#define TCFG_IOKEY_ENABLE DISABLE_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_PREV_CONNECT_WAY ONE_PORT_TO_LOW //按键一端接低电平一端接IO
|
||||
@ -254,8 +253,8 @@
|
||||
#define TCFG_ADKEY_LED_IO_REUSE DISABLE_THIS_MOUDLE //ADKEY 和 LED IO复用,led只能设置蓝灯显示
|
||||
#define TCFG_ADKEY_IR_IO_REUSE DISABLE_THIS_MOUDLE //ADKEY 和 红外IO复用
|
||||
#define TCFG_ADKEY_LED_SPI_IO_REUSE DISABLE_THIS_MOUDLE //ADKEY 和 LED SPI IO复用
|
||||
#define TCFG_ADKEY_PORT IO_PORTA_06 //AD按键端口(需要注意选择的IO口是否支持AD功能)
|
||||
#define TCFG_ADKEY_AD_CHANNEL AD_CH_PA6
|
||||
#define TCFG_ADKEY_PORT IO_PORTB_01 //AD按键端口(需要注意选择的IO口是否支持AD功能)
|
||||
#define TCFG_ADKEY_AD_CHANNEL AD_CH_PB1
|
||||
#define TCFG_ADKEY_EXTERN_UP_ENABLE ENABLE_THIS_MOUDLE //是否使用外部上拉
|
||||
|
||||
#if TCFG_ADKEY_EXTERN_UP_ENABLE
|
||||
@ -266,15 +265,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 * 100 / (100 + R_UP)) //3k
|
||||
#define TCFG_ADKEY_AD2 (0x3ffL * 150 / (150 + R_UP)) //6.2k
|
||||
#define TCFG_ADKEY_AD3 (0x3ffL * 510 / (510 + 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)
|
||||
@ -396,7 +395,7 @@ DAC硬件上的连接方式,可选的配置:
|
||||
DAC_OUTPUT_LR 立体声
|
||||
DAC_OUTPUT_MONO_LR_DIFF 单声道差分输出
|
||||
*/
|
||||
#define TCFG_AUDIO_DAC_CONNECT_MODE DAC_OUTPUT_LR
|
||||
#define TCFG_AUDIO_DAC_CONNECT_MODE DAC_OUTPUT_MONO_L
|
||||
|
||||
|
||||
|
||||
@ -411,7 +410,7 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#define AUDIO_OUTPUT_WAY AUDIO_OUTPUT_WAY_DAC
|
||||
#define LINEIN_INPUT_WAY LINEIN_INPUT_WAY_ANALOG
|
||||
|
||||
#define AUDIO_OUTPUT_AUTOMUTE 0//ENABLE
|
||||
#define AUDIO_OUTPUT_AUTOMUTE 1//ENABLE
|
||||
|
||||
|
||||
/*
|
||||
@ -445,9 +444,9 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#define TCFG_CALL_USE_DIGITAL_VOLUME 0
|
||||
|
||||
// 使能改宏,提示音音量使用music音量
|
||||
#define APP_AUDIO_STATE_WTONE_BY_MUSIC (1)
|
||||
#define APP_AUDIO_STATE_WTONE_BY_MUSIC (0)
|
||||
// 0:提示音不使用默认音量; 1:默认提示音音量值
|
||||
#define TONE_MODE_DEFAULE_VOLUME (0)
|
||||
#define TONE_MODE_DEFAULE_VOLUME (18)
|
||||
|
||||
/*
|
||||
*支持省电容MIC模块
|
||||
@ -456,7 +455,7 @@ DAC硬件上的连接方式,可选的配置:
|
||||
*/
|
||||
#define TCFG_SUPPORT_MIC_CAPLESS ENABLE_THIS_MOUDLE
|
||||
//省电容MIC使能
|
||||
#define TCFG_MIC_CAPLESS_ENABLE DISABLE_THIS_MOUDLE
|
||||
#define TCFG_MIC_CAPLESS_ENABLE ENABLE_THIS_MOUDLE
|
||||
//AudioEffects代码链接管理
|
||||
#define AUDIO_EFFECTS_DRC_AT_RAM 0
|
||||
#define AUDIO_EFFECTS_REVERB_AT_RAM 0
|
||||
@ -505,9 +504,9 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
// UI 配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_UI_ENABLE ENABLE_THIS_MOUDLE //UI总开关
|
||||
#define CONFIG_UI_STYLE STYLE_JL_LED7
|
||||
#define TCFG_UI_LED7_ENABLE ENABLE_THIS_MOUDLE //UI使用LED7显示
|
||||
#define TCFG_UI_ENABLE DISABLE_THIS_MOUDLE //UI总开关
|
||||
//#define CONFIG_UI_STYLE STYLE_JL_LED7
|
||||
#define TCFG_UI_LED7_ENABLE DISABLE_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
|
||||
@ -557,7 +556,7 @@ 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
|
||||
@ -727,8 +726,8 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
#define TCFG_AUTO_SHUT_DOWN_TIME 0 //没有蓝牙连接自动关机时间
|
||||
#define TCFG_SYS_LVD_EN 1 //电量检测使能
|
||||
#define TCFG_POWER_ON_NEED_KEY 0 //是否需要按按键开机配置
|
||||
#define TWFG_APP_POWERON_IGNORE_DEV 4000//上电忽略挂载设备,0时不忽略,非0则n毫秒忽略
|
||||
#define TCFG_POWER_ON_NEED_KEY 1 //是否需要按按键开机配置
|
||||
#define TWFG_APP_POWERON_IGNORE_DEV 0//上电忽略挂载设备,0时不忽略,非0则n毫秒忽略
|
||||
|
||||
#define TCFG_AUDIO_DEC_OUT_TASK 0 // 解码使用单独任务做输出
|
||||
|
||||
@ -764,8 +763,8 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#endif
|
||||
|
||||
#define BT_INBAND_RINGTONE 0 //是否播放手机自带来电铃声
|
||||
#define BT_PHONE_NUMBER 1 //是否播放来电报号
|
||||
#define BT_SYNC_PHONE_RING 1 //是否TWS同步播放来电铃声
|
||||
#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 //是否使能音量同步
|
||||
|
||||
@ -820,9 +819,9 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#if (RECORDER_MIX_EN)
|
||||
#define TCFG_LINEIN_LR_CH AUDIO_LIN0L_CH//AUDIO_LIN0_LR
|
||||
#else
|
||||
#define TCFG_LINEIN_LR_CH AUDIO_LIN0_LR
|
||||
#define TCFG_LINEIN_LR_CH AUDIO_LIN0L_CH
|
||||
#endif/*RECORDER_MIX_EN*/
|
||||
#define TCFG_LINEIN_CHECK_PORT IO_PORTB_01 // linein检测IO
|
||||
#define TCFG_LINEIN_CHECK_PORT IO_PORTC_04 // 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检测
|
||||
@ -833,7 +832,7 @@ DAC硬件上的连接方式,可选的配置:
|
||||
#if (RECORDER_MIX_EN)
|
||||
#define TCFG_LINEIN_INPUT_WAY LINEIN_INPUT_WAY_ADC//LINEIN_INPUT_WAY_ANALOG
|
||||
#else
|
||||
#define TCFG_LINEIN_INPUT_WAY LINEIN_INPUT_WAY_ANALOG
|
||||
#define TCFG_LINEIN_INPUT_WAY LINEIN_INPUT_WAY_ADC
|
||||
#endif/*RECORDER_MIX_EN*/
|
||||
#endif
|
||||
#define TCFG_LINEIN_MULTIPLEX_WITH_FM DISABLE // linein 脚与 FM 脚复用
|
||||
@ -845,8 +844,8 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
#define TCFG_DEC_G729_ENABLE ENABLE
|
||||
#define TCFG_DEC_MP3_ENABLE ENABLE
|
||||
#define TCFG_DEC_WMA_ENABLE ENABLE
|
||||
#define TCFG_DEC_WAV_ENABLE ENABLE
|
||||
#define TCFG_DEC_WMA_ENABLE 1
|
||||
#define TCFG_DEC_WAV_ENABLE 0
|
||||
#define TCFG_DEC_FLAC_ENABLE DISABLE
|
||||
#define TCFG_DEC_APE_ENABLE DISABLE
|
||||
#define TCFG_DEC_M4A_ENABLE DISABLE
|
||||
@ -877,7 +876,7 @@ DAC硬件上的连接方式,可选的配置:
|
||||
|
||||
#define TCFG_FMIN_LADC_IDX 1 // linein使用的ladc通道,对应ladc_list
|
||||
#define TCFG_FMIN_LR_CH AUDIO_LIN1_LR
|
||||
#define TCFG_FM_INPUT_WAY LINEIN_INPUT_WAY_ANALOG
|
||||
#define TCFG_FM_INPUT_WAY LINEIN_INPUT_WAY_ADC
|
||||
|
||||
#if (TCFG_FM_INSIDE_ENABLE && TCFG_FM_ENABLE)
|
||||
#if ((RECORDER_MIX_EN && RECORDER_MIX_BT_PHONE_EN) || (TCFG_MIC_EFFECT_ENABLE) || (TCFG_USER_TWS_ENABLE))
|
||||
@ -974,9 +973,9 @@ DAC硬件上的连接方式,可选的配置:
|
||||
//*********************************************************************************//
|
||||
#define TCFG_ENC_CVSD_ENABLE ENABLE
|
||||
#define TCFG_ENC_MSBC_ENABLE ENABLE
|
||||
#define TCFG_ENC_MP3_ENABLE ENABLE
|
||||
#define TCFG_ENC_ADPCM_ENABLE ENABLE
|
||||
#define TCFG_ENC_SBC_ENABLE ENABLE
|
||||
#define TCFG_ENC_MP3_ENABLE 0
|
||||
#define TCFG_ENC_ADPCM_ENABLE 0
|
||||
#define TCFG_ENC_SBC_ENABLE 0
|
||||
#define TCFG_ENC_OPUS_ENABLE DISABLE
|
||||
#define TCFG_ENC_SPEEX_ENABLE DISABLE
|
||||
|
||||
|
@ -19,22 +19,22 @@ const u16 bt_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX] = {
|
||||
#endif
|
||||
},
|
||||
[1] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_MUSIC_NEXT, KEY_VOL_UP, KEY_VOL_UP, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[2] = {
|
||||
KEY_MUSIC_PP, KEY_CALL_HANG_UP, KEY_NULL, KEY_NULL, KEY_CALL_LAST_NO, KEY_NULL
|
||||
KEY_MUSIC_PREV, KEY_VOL_DOWN, KEY_VOL_DOWN, KEY_NULL, KEY_CALL_LAST_NO, KEY_NULL
|
||||
},
|
||||
[3] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_MUSIC_PP, KEY_CALL_HANG_UP, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[4] = {
|
||||
KEY_MUSIC_PREV, KEY_VOL_DOWN, KEY_VOL_DOWN, KEY_NULL, KEY_ENC_START, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[5] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[6] = {
|
||||
KEY_MUSIC_NEXT, KEY_VOL_UP, KEY_VOL_UP, KEY_NULL, KEY_REVERB_OPEN, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[7] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
@ -55,28 +55,28 @@ const u16 bt_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX] = {
|
||||
const u16 fm_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX] = {
|
||||
//单击 //长按 //hold //抬起 //双击 //三击
|
||||
[0] = {
|
||||
KEY_CHANGE_MODE, KEY_POWEROFF, KEY_POWEROFF_HOLD, KEY_NULL, KEY_FM_SCAN_ALL_DOWN, KEY_NULL
|
||||
KEY_CHANGE_MODE, KEY_POWEROFF, KEY_POWEROFF_HOLD, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[1] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_FM_NEXT_STATION, KEY_VOL_UP, KEY_VOL_UP, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[2] = {
|
||||
KEY_MUSIC_PP, KEY_NULL, KEY_NULL, KEY_NULL, KEY_FM_SCAN_ALL_DOWN, KEY_NULL
|
||||
KEY_FM_PREV_STATION, KEY_VOL_DOWN, KEY_VOL_DOWN, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[3] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_MUSIC_PP, KEY_FM_SCAN_ALL_DOWN, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[4] = {
|
||||
KEY_FM_PREV_STATION, KEY_VOL_DOWN, KEY_VOL_DOWN, KEY_NULL, KEY_ENC_START, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[5] = {
|
||||
KEY_FM_PREV_FREQ, KEY_FM_SCAN_UP, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[6] = {
|
||||
KEY_FM_NEXT_STATION, KEY_VOL_UP, KEY_VOL_UP, KEY_NULL, KEY_REVERB_OPEN, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[7] = {
|
||||
KEY_FM_NEXT_FREQ, KEY_FM_SCAN_DOWN, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[8] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
@ -97,22 +97,22 @@ const u16 linein_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX] = {
|
||||
KEY_CHANGE_MODE, KEY_POWEROFF, KEY_POWEROFF_HOLD, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[1] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_VOL_UP, KEY_VOL_UP, KEY_VOL_UP, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[2] = {
|
||||
KEY_MUSIC_PP, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_VOL_DOWN, KEY_VOL_DOWN, KEY_VOL_DOWN, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[3] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_MUSIC_PP, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[4] = {
|
||||
KEY_NULL, KEY_VOL_DOWN, KEY_VOL_DOWN, KEY_NULL, KEY_ENC_START, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[5] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[6] = {
|
||||
KEY_NULL, KEY_VOL_UP, KEY_VOL_UP, KEY_NULL, KEY_REVERB_OPEN, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[7] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
@ -133,28 +133,28 @@ const u16 linein_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX] = {
|
||||
const u16 music_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX] = {
|
||||
//单击 //长按 //hold //抬起 //双击 //三击
|
||||
[0] = {
|
||||
KEY_CHANGE_MODE, KEY_POWEROFF, KEY_POWEROFF_HOLD, KEY_NULL, KEY_MUSIC_PLAYE_REC_FOLDER_SWITCH, KEY_NULL
|
||||
KEY_CHANGE_MODE, KEY_POWEROFF, KEY_POWEROFF_HOLD, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[1] = {
|
||||
KEY_MUSIC_CHANGE_REPEAT, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_MUSIC_NEXT, KEY_VOL_UP, KEY_VOL_UP, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[2] = {
|
||||
KEY_MUSIC_PP, KEY_MUSIC_CHANGE_DEV, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[3] = {
|
||||
KEY_MUSIC_PLAYE_NEXT_FOLDER, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[4] = {
|
||||
KEY_MUSIC_PREV, KEY_VOL_DOWN, KEY_VOL_DOWN, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[3] = {
|
||||
KEY_MUSIC_PP, KEY_MUSIC_CHANGE_DEV, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[4] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[5] = {
|
||||
KEY_MUSIC_PLAYE_PREV_FOLDER, KEY_NULL, KEY_MUSIC_FR, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[6] = {
|
||||
KEY_MUSIC_NEXT, KEY_VOL_UP, KEY_VOL_UP, KEY_NULL, KEY_REVERB_OPEN, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[7] = {
|
||||
KEY_MUSIC_PLAYE_REC_FOLDER_SWITCH, KEY_NULL, KEY_MUSIC_FF, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[8] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
@ -178,19 +178,19 @@ const u16 pc_key_ad_table[KEY_AD_NUM_MAX][KEY_EVENT_MAX] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[2] = {
|
||||
KEY_MUSIC_PP, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[3] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[4] = {
|
||||
KEY_MUSIC_PREV, KEY_VOL_DOWN, KEY_VOL_DOWN, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[5] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[6] = {
|
||||
KEY_MUSIC_NEXT, KEY_VOL_UP, KEY_VOL_UP, KEY_NULL, KEY_REVERB_OPEN, KEY_NULL
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
},
|
||||
[7] = {
|
||||
KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL, KEY_NULL
|
||||
|
@ -96,6 +96,24 @@ static void app_init()
|
||||
do_platform_initcall();
|
||||
|
||||
board_init();
|
||||
{
|
||||
//mute
|
||||
gpio_set_pull_down(IO_PORTA_04,0);
|
||||
gpio_set_pull_up(IO_PORTA_04,0);
|
||||
gpio_set_direction(IO_PORTA_04,0);
|
||||
gpio_set_output_value(IO_PORTA_04,1);
|
||||
//led
|
||||
gpio_set_pull_down(IO_PORTB_05,0);
|
||||
gpio_set_pull_up(IO_PORTB_05,0);
|
||||
gpio_set_direction(IO_PORTB_05,0);
|
||||
gpio_set_output_value(IO_PORTB_05,0);
|
||||
//pa mode
|
||||
gpio_set_pull_down(IO_PORTA_02,0);
|
||||
gpio_set_pull_up(IO_PORTA_02,0);
|
||||
gpio_set_direction(IO_PORTA_02,0);
|
||||
gpio_set_output_value(IO_PORTA_02,0);
|
||||
|
||||
}
|
||||
|
||||
do_initcall();
|
||||
|
||||
@ -164,6 +182,7 @@ static void app_init()
|
||||
/* clock_add_set(CHARGE_BOX_CLK); */
|
||||
chgbox_init_app();
|
||||
#endif
|
||||
gpio_set_output_value(IO_PORTB_05,1);
|
||||
}
|
||||
|
||||
static void app_task_handler(void *p)
|
||||
|
@ -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 //轻量级打印开关, 默认关闭
|
||||
@ -159,6 +159,8 @@
|
||||
#include "usb_common_def.h"
|
||||
|
||||
|
||||
#define CONFIG_TWS_COMMON_ADDR_SELECT 0xFF
|
||||
|
||||
#if TCFG_USER_TWS_ENABLE
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define _FM_SEVER__H_
|
||||
|
||||
|
||||
u8 fm_get_play_statue(void);
|
||||
void fm_volume_pp(void);//播放暂停
|
||||
void fm_scan_down();//半自动收台
|
||||
void fm_scan_up();//半自动收台
|
||||
|
@ -2,8 +2,8 @@
|
||||
1:
|
||||
|
||||
|
||||
|
||||
|
||||
.gpio_ram
|
||||
.LED_code
|
||||
|
||||
|
||||
.usr_timer_code
|
||||
|
@ -39,8 +39,6 @@
|
||||
|
||||
**************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "system/includes.h"
|
||||
#include "media/includes.h"
|
||||
|
||||
@ -65,7 +63,6 @@
|
||||
#include "math.h"
|
||||
#include "spp_user.h"
|
||||
|
||||
|
||||
#include "app_chargestore.h"
|
||||
#include "app_charge.h"
|
||||
#include "app_main.h"
|
||||
@ -94,7 +91,6 @@
|
||||
#include "multi_demo/le_multi_common.h"
|
||||
#include "app_protocol_api.h"
|
||||
|
||||
|
||||
#define LOG_TAG_CONST BT
|
||||
#define LOG_TAG "[BT]"
|
||||
#define LOG_ERROR_ENABLE
|
||||
@ -104,7 +100,6 @@
|
||||
#define LOG_CLI_ENABLE
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
#if TCFG_APP_BT_EN
|
||||
|
||||
struct app_bt_opr app_bt_hdl = {
|
||||
@ -120,7 +115,67 @@ struct app_bt_opr app_bt_hdl = {
|
||||
|
||||
BT_USER_PRIV_VAR bt_user_priv_var;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static u16 tm_led;
|
||||
static int t_cnt;
|
||||
static u8 led_flag;
|
||||
static u8 playing = 0;
|
||||
|
||||
static void led_cb(void *priv)
|
||||
{
|
||||
if (get_bt_connect_status() < BT_STATUS_CONNECTING)
|
||||
{
|
||||
if (led_flag == 1)
|
||||
{
|
||||
led_flag = 0;
|
||||
gpio_set_output_value(IO_PORTB_05, led_flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
led_flag = 1;
|
||||
gpio_set_output_value(IO_PORTB_05, led_flag);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (playing == 1)
|
||||
{
|
||||
t_cnt++;
|
||||
if (t_cnt > 1)
|
||||
{
|
||||
t_cnt = 0;
|
||||
if (led_flag == 1)
|
||||
{
|
||||
led_flag = 0;
|
||||
gpio_set_output_value(IO_PORTB_05, led_flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
led_flag = 1;
|
||||
gpio_set_output_value(IO_PORTB_05, led_flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
led_flag = 1;
|
||||
gpio_set_output_value(IO_PORTB_05, led_flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void start_led(void)
|
||||
{
|
||||
if (tm_led)
|
||||
{
|
||||
sys_timer_del(tm_led);
|
||||
}
|
||||
|
||||
t_cnt = 0;
|
||||
led_flag = 1;
|
||||
playing = 0;
|
||||
tm_led = sys_timer_add(NULL, led_cb, 250);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式变量初始化
|
||||
@ -134,7 +189,6 @@ void bt_var_init()
|
||||
memset((u8 *)&bt_user_priv_var, 0, sizeof(BT_USER_PRIV_VAR));
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式协议栈回调函数
|
||||
@param 无
|
||||
@ -144,7 +198,7 @@ void bt_var_init()
|
||||
/*----------------------------------------------------------------------------*/
|
||||
void bredr_handle_register()
|
||||
{
|
||||
#if (USER_SUPPORT_PROFILE_SPP==1)
|
||||
#if (USER_SUPPORT_PROFILE_SPP == 1)
|
||||
#if APP_ONLINE_DEBUG
|
||||
extern void online_spp_init(void);
|
||||
spp_data_deal_handle_register(user_spp_data_handler);
|
||||
@ -155,22 +209,22 @@ void bredr_handle_register()
|
||||
#endif
|
||||
|
||||
#if BT_SUPPORT_MUSIC_VOL_SYNC
|
||||
///蓝牙音乐和通话音量同步
|
||||
/// 蓝牙音乐和通话音量同步
|
||||
music_vol_change_handle_register(bt_set_music_device_volume, phone_get_device_vol);
|
||||
#endif
|
||||
|
||||
#if BT_SUPPORT_DISPLAY_BAT
|
||||
///电量显示获取电量的接口
|
||||
/// 电量显示获取电量的接口
|
||||
get_battery_value_register(bt_get_battery_value);
|
||||
#endif
|
||||
|
||||
///被测试盒链接上进入快速测试回调
|
||||
/// 被测试盒链接上进入快速测试回调
|
||||
bt_fast_test_handle_register(bt_fast_test_api);
|
||||
|
||||
///样机进入dut被测试仪器链接上回调
|
||||
/// 样机进入dut被测试仪器链接上回调
|
||||
bt_dut_test_handle_register(bt_dut_api);
|
||||
|
||||
///获取远端设备蓝牙名字回调
|
||||
/// 获取远端设备蓝牙名字回调
|
||||
read_remote_name_handle_register(bt_read_remote_name);
|
||||
|
||||
////获取歌曲信息回调
|
||||
@ -180,8 +234,8 @@ void bredr_handle_register()
|
||||
}
|
||||
|
||||
#if TRANS_MULTI_BLE_EN && TRANS_MULTI_BLE_MASTER_NUMS
|
||||
//指定搜索uuid
|
||||
//指定搜索uuid
|
||||
// 指定搜索uuid
|
||||
// 指定搜索uuid
|
||||
static const target_uuid_t jl_search_uuid_table[] = {
|
||||
|
||||
// for uuid16
|
||||
@ -201,7 +255,7 @@ static const target_uuid_t jl_search_uuid_table[] = {
|
||||
.opt_type = ATT_PROPERTY_NOTIFY,
|
||||
},
|
||||
|
||||
//for uuid128,sample
|
||||
// for uuid128,sample
|
||||
// PRIMARY_SERVICE, 0000F530-1212-EFDE-1523-785FEABCD123
|
||||
// CHARACTERISTIC, 0000F531-1212-EFDE-1523-785FEABCD123, NOTIFY,
|
||||
// CHARACTERISTIC, 0000F532-1212-EFDE-1523-785FEABCD123, WRITE_WITHOUT_RESPONSE | DYNAMIC,
|
||||
@ -225,7 +279,6 @@ static const target_uuid_t jl_search_uuid_table[] = {
|
||||
|
||||
};
|
||||
|
||||
|
||||
static void ble_report_data_deal(att_data_report_t *report_data, target_uuid_t *search_uuid)
|
||||
{
|
||||
log_info("conn_handle:%04x,report_data:%02x,%02x,%d,len(%d)", report_data->conn_handle, report_data->packet_type,
|
||||
@ -238,15 +291,16 @@ static void ble_report_data_deal(att_data_report_t *report_data, target_uuid_t *
|
||||
/* return; */
|
||||
/* } */
|
||||
|
||||
switch (report_data->packet_type) {
|
||||
case GATT_EVENT_NOTIFICATION: //notify
|
||||
switch (report_data->packet_type)
|
||||
{
|
||||
case GATT_EVENT_NOTIFICATION: // notify
|
||||
break;
|
||||
|
||||
case GATT_EVENT_INDICATION://indicate
|
||||
case GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT://read
|
||||
case GATT_EVENT_INDICATION: // indicate
|
||||
case GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT: // read
|
||||
break;
|
||||
|
||||
case GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT://read long
|
||||
case GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT: // read long
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -255,13 +309,13 @@ static void ble_report_data_deal(att_data_report_t *report_data, target_uuid_t *
|
||||
}
|
||||
|
||||
static struct ble_client_operation_t *ble_client_api;
|
||||
static const u8 test_remoter_name1[] = "AC897N_MX(BLE)";//
|
||||
static const u8 test_remoter_name1[] = "AC897N_MX(BLE)"; //
|
||||
static u16 ble_client_write_handle;
|
||||
static u16 ble_client_timer = 0;
|
||||
|
||||
static const client_match_cfg_t match_dev01 = {
|
||||
.create_conn_mode = BIT(CLI_CREAT_BY_NAME),
|
||||
.compare_data_len = sizeof(test_remoter_name1) - 1, //去结束符
|
||||
.compare_data_len = sizeof(test_remoter_name1) - 1, // 去结束符
|
||||
.compare_data = test_remoter_name1,
|
||||
.bonding_flag = 0,
|
||||
};
|
||||
@ -280,10 +334,12 @@ static void client_test_write(void)
|
||||
u16 tmp_handle;
|
||||
|
||||
count++;
|
||||
for (i = 0; i < SUPPORT_MAX_CLIENT; i++) {
|
||||
for (i = 0; i < SUPPORT_MAX_CLIENT; i++)
|
||||
{
|
||||
tmp_handle = mul_dev_get_conn_handle(i, MULTI_ROLE_CLIENT);
|
||||
|
||||
if (tmp_handle) {
|
||||
if (tmp_handle)
|
||||
{
|
||||
ret = ble_client_api->opt_comm_send_ext(tmp_handle, ble_client_write_handle, &count, 16, ATT_OP_WRITE_WITHOUT_RESPOND);
|
||||
log_info("test_write:%04x,%d", tmp_handle, ret);
|
||||
}
|
||||
@ -293,19 +349,22 @@ static void client_test_write(void)
|
||||
/* log_info("test_write:%x", ret); */
|
||||
}
|
||||
|
||||
|
||||
static void client_event_callback(le_client_event_e event, u8 *packet, int size)
|
||||
{
|
||||
switch (event) {
|
||||
case CLI_EVENT_MATCH_DEV: {
|
||||
switch (event)
|
||||
{
|
||||
case CLI_EVENT_MATCH_DEV:
|
||||
{
|
||||
client_match_cfg_t *match_dev = packet;
|
||||
log_info("match_name:%s\n", match_dev->compare_data);
|
||||
}
|
||||
break;
|
||||
|
||||
case CLI_EVENT_MATCH_UUID: {
|
||||
case CLI_EVENT_MATCH_UUID:
|
||||
{
|
||||
opt_handle_t *opt_hdl = packet;
|
||||
if (opt_hdl->search_uuid == &jl_search_uuid_table[0]) {
|
||||
if (opt_hdl->search_uuid == &jl_search_uuid_table[0])
|
||||
{
|
||||
ble_client_write_handle = opt_hdl->value_handle;
|
||||
log_info("match_uuid22\n");
|
||||
}
|
||||
@ -314,7 +373,8 @@ static void client_event_callback(le_client_event_e event, u8 *packet, int size)
|
||||
|
||||
case CLI_EVENT_SEARCH_PROFILE_COMPLETE:
|
||||
log_info("CLI_EVENT_SEARCH_PROFILE_COMPLETE\n");
|
||||
if ((!ble_client_timer) && ble_client_write_handle) {
|
||||
if ((!ble_client_timer) && ble_client_write_handle)
|
||||
{
|
||||
log_info("test timer_add\n");
|
||||
ble_client_timer = sys_timer_add(0, client_test_write, 500);
|
||||
}
|
||||
@ -324,7 +384,8 @@ static void client_event_callback(le_client_event_e event, u8 *packet, int size)
|
||||
break;
|
||||
|
||||
case CLI_EVENT_DISCONNECT:
|
||||
if (ble_client_timer) {
|
||||
if (ble_client_timer)
|
||||
{
|
||||
sys_timeout_del(ble_client_timer);
|
||||
}
|
||||
ble_client_timer = 0;
|
||||
@ -336,7 +397,6 @@ static void client_event_callback(le_client_event_e event, u8 *packet, int size)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const client_conn_cfg_t client_conn_config = {
|
||||
.match_dev_cfg[0] = &match_dev01,
|
||||
.match_dev_cfg[1] = NULL,
|
||||
@ -346,7 +406,7 @@ static const client_conn_cfg_t client_conn_config = {
|
||||
/* .search_uuid_cnt = 0, //配置不搜索profile,加快回连速度 */
|
||||
.search_uuid_cnt = (sizeof(jl_search_uuid_table) / sizeof(target_uuid_t)),
|
||||
.search_uuid_table = jl_search_uuid_table,
|
||||
.security_en = 0, //支持加密使能,对应配置 config_le_sm_support_enable
|
||||
.security_en = 0, // 支持加密使能,对应配置 config_le_sm_support_enable
|
||||
.event_callback = client_event_callback,
|
||||
};
|
||||
|
||||
@ -359,8 +419,6 @@ static void ble_client_config_init(void)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式协议栈功能配置
|
||||
@param 无
|
||||
@ -401,9 +459,9 @@ void bt_function_select_init()
|
||||
#endif
|
||||
|
||||
#if (TCFG_SPI_LCD_ENABLE)
|
||||
#if TCFG_USER_EMITTER_ENABLE//带有屏幕的方案根据UI选项连接
|
||||
#if TCFG_USER_EMITTER_ENABLE // 带有屏幕的方案根据UI选项连接
|
||||
////设置开机回链的设备个数
|
||||
__set_auto_conn_device_num(10);//彩屏方案支持10个设备的连接
|
||||
__set_auto_conn_device_num(10); // 彩屏方案支持10个设备的连接
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -416,12 +474,11 @@ void bt_function_select_init()
|
||||
__set_user_background_goback(BACKGROUND_GOBACK); // 后台链接是否跳回蓝牙 1:跳回
|
||||
|
||||
////设置蓝牙加密的level
|
||||
//io_capabilities ; /*0: Display only 1: Display YesNo 2: KeyboardOnly 3: NoInputNoOutput*/
|
||||
//authentication_requirements: 0:not protect 1 :protect
|
||||
// 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);
|
||||
|
||||
|
||||
#if (USER_SUPPORT_PROFILE_PBAP==1)
|
||||
#if (USER_SUPPORT_PROFILE_PBAP == 1)
|
||||
////设置蓝牙设备类型
|
||||
__change_hci_class_type(BD_CLASS_CAR_AUDIO);
|
||||
#endif
|
||||
@ -431,7 +488,6 @@ void bt_function_select_init()
|
||||
lmp_set_sniff_disable();
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
TX RX
|
||||
AI800x PA13 PA12
|
||||
@ -473,7 +529,6 @@ void bt_function_select_init()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式协议栈对应状态处理函数
|
||||
@param bt:事件
|
||||
@ -486,11 +541,13 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
|
||||
log_debug("-----------------------bt_connction_status_event_handler %d", bt->event);
|
||||
|
||||
if (bt_status_event_filter(bt) == false) {
|
||||
if (bt_status_event_filter(bt) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (bt->event) {
|
||||
switch (bt->event)
|
||||
{
|
||||
case BT_STATUS_EXIT_OK:
|
||||
log_info("BT_STATUS_EXIT_OK\n");
|
||||
break;
|
||||
@ -502,7 +559,7 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
app_protocol_init(TME_HANDLER_ID);
|
||||
app_protocol_init(MMA_HANDLER_ID);
|
||||
bt_status_init_ok(bt);
|
||||
#if(TCFG_TEST_BOX_ENABLE || TCFG_CHARGESTORE_ENABLE)
|
||||
#if (TCFG_TEST_BOX_ENABLE || TCFG_CHARGESTORE_ENABLE)
|
||||
chargestore_set_bt_init_ok(1);
|
||||
#endif
|
||||
break;
|
||||
@ -557,10 +614,12 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
break;
|
||||
case BT_STATUS_A2DP_MEDIA_START:
|
||||
log_info(" BT_STATUS_A2DP_MEDIA_START\n");
|
||||
playing = 1;
|
||||
bt_status_a2dp_media_start(bt);
|
||||
break;
|
||||
case BT_STATUS_A2DP_MEDIA_STOP:
|
||||
log_info(" BT_STATUS_A2DP_MEDIA_STOP");
|
||||
playing = 0;
|
||||
bt_status_a2dp_media_stop(bt);
|
||||
break;
|
||||
case BT_STATUS_SCO_STATUS_CHANGE:
|
||||
@ -572,7 +631,7 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
bt_status_call_vol_change(bt);
|
||||
break;
|
||||
case BT_STATUS_SNIFF_STATE_UPDATE:
|
||||
log_info(" BT_STATUS_SNIFF_STATE_UPDATE \n"); //0退出SNIFF
|
||||
log_info(" BT_STATUS_SNIFF_STATE_UPDATE \n"); // 0退出SNIFF
|
||||
bt_status_sniff_state_update(bt);
|
||||
break;
|
||||
case BT_STATUS_LAST_CALL_TYPE_CHANGE:
|
||||
@ -607,12 +666,6 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式协议栈事件
|
||||
@param bt:事件
|
||||
@ -622,22 +675,24 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static int bt_hci_event_handler(struct bt_event *bt)
|
||||
{
|
||||
//对应原来的蓝牙连接上断开处理函数 ,bt->value=reason
|
||||
// 对应原来的蓝牙连接上断开处理函数 ,bt->value=reason
|
||||
log_debug("------------------------bt_hci_event_handler reason %x %x", bt->event, bt->value);
|
||||
|
||||
|
||||
#if TCFG_VIRTUAL_FAST_CONNECT_FOR_EMITTER
|
||||
extern u8 bt_fast_conn_hci_event_filter(struct bt_event * bt);
|
||||
if (bt_fast_conn_hci_event_filter(bt) == 0) {
|
||||
if (bt_fast_conn_hci_event_filter(bt) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (bt_hci_event_filter(bt) == 0) {
|
||||
if (bt_hci_event_filter(bt) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (bt->event) {
|
||||
switch (bt->event)
|
||||
{
|
||||
case HCI_EVENT_INQUIRY_COMPLETE:
|
||||
log_info(" HCI_EVENT_INQUIRY_COMPLETE \n");
|
||||
bt_hci_event_inquiry(bt);
|
||||
@ -648,57 +703,58 @@ static int bt_hci_event_handler(struct bt_event *bt)
|
||||
break;
|
||||
case HCI_EVENT_USER_CONFIRMATION_REQUEST:
|
||||
log_info(" HCI_EVENT_USER_CONFIRMATION_REQUEST \n");
|
||||
///<可通过按键来确认是否配对 1:配对 0:取消
|
||||
///< 可通过按键来确认是否配对 1:配对 0:取消
|
||||
bt_send_pair(1);
|
||||
clock_remove_set(BT_CONN_CLK);
|
||||
break;
|
||||
case HCI_EVENT_USER_PASSKEY_REQUEST:
|
||||
log_info(" HCI_EVENT_USER_PASSKEY_REQUEST \n");
|
||||
///<可以开始输入6位passkey
|
||||
///< 可以开始输入6位passkey
|
||||
break;
|
||||
|
||||
case HCI_EVENT_REMOTE_KEYPRESS_NOTIFICATION:
|
||||
log_info(" HCI_EVENT_REMOTE_KEYPRESS_NOTIFICATION %x\n", bt->value);
|
||||
///<可用于显示输入passkey位置 value 0:start 1:enrer 2:earse 3:clear 4:complete
|
||||
///< 可用于显示输入passkey位置 value 0:start 1:enrer 2:earse 3:clear 4:complete
|
||||
break;
|
||||
|
||||
case HCI_EVENT_USER_PRESSKEY_NOTIFICATION:
|
||||
log_info(" HCI_EVENT_USER_PRESSKEY_NOTIFICATION %x\n", bt->value);
|
||||
break;
|
||||
|
||||
case HCI_EVENT_PIN_CODE_REQUEST :
|
||||
case HCI_EVENT_PIN_CODE_REQUEST:
|
||||
log_info("HCI_EVENT_PIN_CODE_REQUEST \n");
|
||||
bt_send_pair(1);
|
||||
break;
|
||||
case HCI_EVENT_VENDOR_NO_RECONN_ADDR :
|
||||
case HCI_EVENT_VENDOR_NO_RECONN_ADDR:
|
||||
log_info("HCI_EVENT_VENDOR_NO_RECONN_ADDR \n");
|
||||
bt_hci_event_disconnect(bt) ;
|
||||
bt_hci_event_disconnect(bt);
|
||||
break;
|
||||
case HCI_EVENT_DISCONNECTION_COMPLETE :
|
||||
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
||||
log_info("HCI_EVENT_DISCONNECTION_COMPLETE \n");
|
||||
bt_hci_event_disconnect(bt) ;
|
||||
bt_hci_event_disconnect(bt);
|
||||
clock_remove_set(BT_CONN_CLK);
|
||||
break;
|
||||
case BTSTACK_EVENT_HCI_CONNECTIONS_DELETE:
|
||||
case HCI_EVENT_CONNECTION_COMPLETE:
|
||||
log_info(" HCI_EVENT_CONNECTION_COMPLETE \n");
|
||||
switch (bt->value) {
|
||||
case ERROR_CODE_SUCCESS :
|
||||
switch (bt->value)
|
||||
{
|
||||
case ERROR_CODE_SUCCESS:
|
||||
log_info("ERROR_CODE_SUCCESS \n");
|
||||
bt_hci_event_connection(bt);
|
||||
break;
|
||||
case ERROR_CODE_PIN_OR_KEY_MISSING:
|
||||
log_info(" ERROR_CODE_PIN_OR_KEY_MISSING \n");
|
||||
bt_hci_event_linkkey_missing(bt);
|
||||
case ERROR_CODE_SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED :
|
||||
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:
|
||||
case ERROR_CODE_CONNECTION_ACCEPT_TIMEOUT_EXCEEDED :
|
||||
case ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION :
|
||||
case ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST :
|
||||
case ERROR_CODE_AUTHENTICATION_FAILURE :
|
||||
case ERROR_CODE_CONNECTION_ACCEPT_TIMEOUT_EXCEEDED:
|
||||
case ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION:
|
||||
case ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST:
|
||||
case ERROR_CODE_AUTHENTICATION_FAILURE:
|
||||
case CUSTOM_BB_AUTO_CANCEL_PAGE:
|
||||
bt_hci_event_disconnect(bt) ;
|
||||
bt_hci_event_disconnect(bt);
|
||||
break;
|
||||
case ERROR_CODE_PAGE_TIMEOUT:
|
||||
log_info(" ERROR_CODE_PAGE_TIMEOUT \n");
|
||||
@ -708,7 +764,7 @@ static int bt_hci_event_handler(struct bt_event *bt)
|
||||
log_info(" ERROR_CODE_CONNECTION_TIMEOUT \n");
|
||||
bt_hci_event_connection_timeout(bt);
|
||||
break;
|
||||
case ERROR_CODE_ACL_CONNECTION_ALREADY_EXISTS :
|
||||
case ERROR_CODE_ACL_CONNECTION_ALREADY_EXISTS:
|
||||
log_info("ERROR_CODE_ACL_CONNECTION_ALREADY_EXISTS \n");
|
||||
bt_hci_event_connection_exist(bt);
|
||||
break;
|
||||
@ -722,8 +778,6 @@ static int bt_hci_event_handler(struct bt_event *bt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙后台事件过滤处理
|
||||
@param event: 事件
|
||||
@ -735,25 +789,30 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
{
|
||||
u8 ret = 0;
|
||||
#if TCFG_BLUETOOTH_BACK_MODE
|
||||
if ((u32)event->arg == SYS_BT_EVENT_TYPE_CON_STATUS) {
|
||||
if ((u32)event->arg == SYS_BT_EVENT_TYPE_CON_STATUS)
|
||||
{
|
||||
log_info("bt con event: %d \n", event->u.bt.event);
|
||||
switch (event->u.bt.event) {
|
||||
switch (event->u.bt.event)
|
||||
{
|
||||
// 需要切换蓝牙的命令
|
||||
case BT_STATUS_A2DP_MEDIA_START:
|
||||
if (__this->sbc_packet_step != 0) {
|
||||
if (__this->sbc_packet_step != 0)
|
||||
{
|
||||
/* log_info("sbc_packet_step : %d \n", __this->sbc_packet_step); */
|
||||
break;
|
||||
}
|
||||
|
||||
case BT_STATUS_FIRST_DISCONNECT:
|
||||
case BT_STATUS_SECOND_DISCONNECT:
|
||||
//关机导致的断开不可以回去蓝牙,否则后台关机会有问题
|
||||
if (app_var.goto_poweroff_flag) {
|
||||
// 关机导致的断开不可以回去蓝牙,否则后台关机会有问题
|
||||
if (app_var.goto_poweroff_flag)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (__this->close_bt_hw_in_background) {
|
||||
//需要后台关闭蓝牙硬件的就不返回蓝牙了
|
||||
if (__this->close_bt_hw_in_background)
|
||||
{
|
||||
// 需要后台关闭蓝牙硬件的就不返回蓝牙了
|
||||
printf("close_bt_hw_in_background not go back\n");
|
||||
break;
|
||||
}
|
||||
@ -764,11 +823,13 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
ret = 1;
|
||||
#endif
|
||||
#else
|
||||
//判断断开的是sink设备,默认切换蓝牙
|
||||
if (event->u.bt.value) {
|
||||
// 判断断开的是sink设备,默认切换蓝牙
|
||||
if (event->u.bt.value)
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
if (ret == 0) {
|
||||
if (ret == 0)
|
||||
{
|
||||
bt_status_disconnect_background(&event->u.bt);
|
||||
}
|
||||
#endif
|
||||
@ -826,9 +887,12 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
bt_connction_status_event_handler(&event->u.bt);
|
||||
break;
|
||||
}
|
||||
} else if ((u32)event->arg == SYS_BT_EVENT_TYPE_HCI_STATUS) {
|
||||
}
|
||||
else if ((u32)event->arg == SYS_BT_EVENT_TYPE_HCI_STATUS)
|
||||
{
|
||||
/* log_info("bt hci event: %d \n", event->u.bt.event); */
|
||||
switch (event->u.bt.event) {
|
||||
switch (event->u.bt.event)
|
||||
{
|
||||
case HCI_EVENT_IO_CAPABILITY_REQUEST:
|
||||
clock_add_set(BT_CONN_CLK);
|
||||
#if BACKGROUND_GOBACK
|
||||
@ -845,9 +909,11 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
}
|
||||
}
|
||||
#if TCFG_USER_TWS_ENABLE
|
||||
else if (((u32)event->arg == SYS_BT_EVENT_FROM_TWS)) {
|
||||
else if (((u32)event->arg == SYS_BT_EVENT_FROM_TWS))
|
||||
{
|
||||
/* log_info("bt tws event: %d \n", event->u.bt.event); */
|
||||
switch (event->u.bt.event) {
|
||||
switch (event->u.bt.event)
|
||||
{
|
||||
/* case TWS_EVENT_CONNECTED: */
|
||||
/* ret = 1; */
|
||||
/* break; */
|
||||
@ -860,8 +926,10 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if ((u32)event->arg == SYS_EVENT_FROM_CTRLER) {
|
||||
switch (event->u.bt.event) {
|
||||
else if ((u32)event->arg == SYS_EVENT_FROM_CTRLER)
|
||||
{
|
||||
switch (event->u.bt.event)
|
||||
{
|
||||
case BTCTRLER_EVENT_RESUME_REQ:
|
||||
/*log_info("------- BTCTRLER_EVENT_RESUME_REQ \n"); */
|
||||
ret = 2;
|
||||
@ -882,12 +950,17 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
int bt_background_event_handler(struct sys_event *event)
|
||||
{
|
||||
int ret = bt_background_event_handler_filter(event);
|
||||
if (ret) {
|
||||
if (false == app_check_curr_task(APP_BT_TASK)) {
|
||||
if (ret)
|
||||
{
|
||||
if (false == app_check_curr_task(APP_BT_TASK))
|
||||
{
|
||||
__this->cmd_flag = 1;
|
||||
if (ret == 2) {
|
||||
if (ret == 2)
|
||||
{
|
||||
__this->call_flag = 1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
__this->call_flag = 0;
|
||||
}
|
||||
app_task_switch_to(APP_BT_TASK);
|
||||
@ -897,14 +970,13 @@ int bt_background_event_handler(struct sys_event *event)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//#if (USER_SUPPORT_PROFILE_HID==1)
|
||||
// #if (USER_SUPPORT_PROFILE_HID==1)
|
||||
////重写bt_get_hid_name
|
||||
//const char * bt_get_hid_name()
|
||||
// const char * bt_get_hid_name()
|
||||
//{
|
||||
// return "HID_USER";
|
||||
//}
|
||||
//#endif
|
||||
// }
|
||||
// #endif
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式按键响应处理
|
||||
@ -918,7 +990,8 @@ int bt_key_event_handler(struct sys_event *event)
|
||||
int ret = true;
|
||||
struct key_event *key = &event->u.key;
|
||||
|
||||
if (bt_key_event_filter_before() == false) {
|
||||
if (bt_key_event_filter_before() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -927,11 +1000,13 @@ int bt_key_event_handler(struct sys_event *event)
|
||||
|
||||
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) {
|
||||
if (bt_key_event_filter_after(key_event) == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (key_event) {
|
||||
switch (key_event)
|
||||
{
|
||||
|
||||
case KEY_MUSIC_PP:
|
||||
log_info(" KEY_MUSIC_PP \n");
|
||||
@ -985,23 +1060,25 @@ int bt_key_event_handler(struct sys_event *event)
|
||||
log_info(" KEY_NULL \n");
|
||||
ret = false;
|
||||
#if TCFG_USER_TWS_ENABLE
|
||||
if ((u32)event->arg == KEY_EVENT_FROM_TWS) {
|
||||
if ((u32)event->arg == KEY_EVENT_FROM_TWS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case KEY_HID_MODE_SWITCH:
|
||||
#if (USER_SUPPORT_PROFILE_HID==1)
|
||||
#if (USER_SUPPORT_PROFILE_HID == 1)
|
||||
__this->hid_mode = !__this->hid_mode;
|
||||
printf("KEY_HID_TAKE_PICTURE, %d\n", __this->hid_mode);
|
||||
user_change_profile_mode(__this->hid_mode);///HID设备名称, 默认蓝牙名称追加_HID
|
||||
//如果要修改名称, 可以重写重写这个函数,上面有重写例子
|
||||
//const char *__attribute__((weak)) bt_get_hid_name()
|
||||
user_change_profile_mode(__this->hid_mode); /// HID设备名称, 默认蓝牙名称追加_HID
|
||||
// 如果要修改名称, 可以重写重写这个函数,上面有重写例子
|
||||
// const char *__attribute__((weak)) bt_get_hid_name()
|
||||
#endif
|
||||
break;
|
||||
case KEY_HID_TAKE_PICTURE:
|
||||
if (__this->hid_mode) {
|
||||
if (__this->hid_mode)
|
||||
{
|
||||
printf("KEY_HID_TAKE_PICTURE\n");
|
||||
user_send_cmd_prepare(USER_CTRL_HID_BOTH, 0, NULL);
|
||||
}
|
||||
@ -1012,11 +1089,15 @@ int bt_key_event_handler(struct sys_event *event)
|
||||
#if (TCFG_DEC2TWS_ENABLE)
|
||||
ret = false;
|
||||
#else
|
||||
if (tws_api_get_tws_state() & TWS_STA_SIBLING_CONNECTED) {
|
||||
if (tws_api_get_role() == TWS_ROLE_MASTER) {
|
||||
if (tws_api_get_tws_state() & TWS_STA_SIBLING_CONNECTED)
|
||||
{
|
||||
if (tws_api_get_role() == TWS_ROLE_MASTER)
|
||||
{
|
||||
bt_tws_api_push_cmd(SYNC_CMD_MODE_CHANGE, 400);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
@ -1036,7 +1117,6 @@ int bt_key_event_handler(struct sys_event *event)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式协议栈状态事件、hci事件、对箱事件
|
||||
@param event: 事件
|
||||
@ -1047,20 +1127,28 @@ int bt_key_event_handler(struct sys_event *event)
|
||||
int bt_sys_event_office(struct sys_event *event)
|
||||
{
|
||||
u8 ret = false;
|
||||
if ((u32)event->arg == SYS_BT_EVENT_TYPE_CON_STATUS) {
|
||||
if ((u32)event->arg == SYS_BT_EVENT_TYPE_CON_STATUS)
|
||||
{
|
||||
bt_connction_status_event_handler(&event->u.bt);
|
||||
} else if ((u32)event->arg == SYS_BT_EVENT_TYPE_HCI_STATUS) {
|
||||
}
|
||||
else if ((u32)event->arg == SYS_BT_EVENT_TYPE_HCI_STATUS)
|
||||
{
|
||||
bt_hci_event_handler(&event->u.bt);
|
||||
} else if ((u32)event->arg == SYS_BT_EVENT_FORM_SELF) {
|
||||
}
|
||||
else if ((u32)event->arg == SYS_BT_EVENT_FORM_SELF)
|
||||
{
|
||||
bt_reverb_status_change(&event->u.bt);
|
||||
}
|
||||
#if TCFG_USER_TWS_ENABLE
|
||||
else if (((u32)event->arg == SYS_BT_EVENT_FROM_TWS)) {
|
||||
else if (((u32)event->arg == SYS_BT_EVENT_FROM_TWS))
|
||||
{
|
||||
ret = bt_tws_connction_status_event_handler(&event->u.bt);
|
||||
}
|
||||
#endif
|
||||
else if (((u32)event->arg == SYS_BT_EVENT_FROM_KEY)) {
|
||||
switch (event->u.key.event) {
|
||||
else if (((u32)event->arg == SYS_BT_EVENT_FROM_KEY))
|
||||
{
|
||||
switch (event->u.key.event)
|
||||
{
|
||||
case KEY_CHANGE_MODE:
|
||||
app_task_switch_next();
|
||||
break;
|
||||
@ -1069,7 +1157,6 @@ int bt_sys_event_office(struct sys_event *event)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/**@brief 蓝牙模式事件消息处理
|
||||
@param event: 事件
|
||||
@ -1080,7 +1167,8 @@ int bt_sys_event_office(struct sys_event *event)
|
||||
static int bt_sys_event_handler(struct sys_event *event)
|
||||
{
|
||||
int ret = false;
|
||||
switch (event->type) {
|
||||
switch (event->type)
|
||||
{
|
||||
case SYS_KEY_EVENT:
|
||||
ret = bt_key_event_handler(event);
|
||||
break;
|
||||
@ -1089,8 +1177,9 @@ static int bt_sys_event_handler(struct sys_event *event)
|
||||
break;
|
||||
case SYS_DEVICE_EVENT:
|
||||
#if APP_ONLINE_DEBUG
|
||||
if ((u32)event->arg == DEVICE_EVENT_ONLINE_DATA) {
|
||||
//putchar('%');
|
||||
if ((u32)event->arg == DEVICE_EVENT_ONLINE_DATA)
|
||||
{
|
||||
// putchar('%');
|
||||
extern void app_online_event_handle(int evt_value);
|
||||
app_online_event_handle(event->u.dev.value);
|
||||
}
|
||||
@ -1115,14 +1204,16 @@ static void bt_tone_play_end_callback(void *priv, int flag)
|
||||
{
|
||||
u32 index = (u32)priv;
|
||||
|
||||
if (APP_BT_TASK != app_get_curr_task()) {
|
||||
if (APP_BT_TASK != app_get_curr_task())
|
||||
{
|
||||
log_error("tone callback task out \n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (index) {
|
||||
switch (index)
|
||||
{
|
||||
case IDEX_TONE_BT_MODE:
|
||||
///提示音播放结束, 启动播放器播放
|
||||
/// 提示音播放结束, 启动播放器播放
|
||||
bt_task_start();
|
||||
break;
|
||||
default:
|
||||
@ -1143,7 +1234,15 @@ void app_bt_task()
|
||||
int msg[32];
|
||||
ui_update_status(STATUS_EXIT_LOWPOWER);
|
||||
|
||||
bt_task_init();//初始化变量、时钟、显示(未进行协议栈初始化)
|
||||
// PA mode set to class D
|
||||
gpio_set_pull_down(IO_PORTA_02, 0);
|
||||
gpio_set_pull_up(IO_PORTA_02, 0);
|
||||
gpio_set_direction(IO_PORTA_02, 0);
|
||||
gpio_set_output_value(IO_PORTA_02, 0);
|
||||
|
||||
|
||||
|
||||
bt_task_init(); // 初始化变量、时钟、显示(未进行协议栈初始化)
|
||||
|
||||
#if TCFG_TONE2TWS_ENABLE
|
||||
extern void tone2tws_bt_task_start(u8 tone_play);
|
||||
@ -1151,33 +1250,45 @@ void app_bt_task()
|
||||
#endif
|
||||
|
||||
extern u8 get_tws_background_connected_flag();
|
||||
if (!__this->cmd_flag && (!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);
|
||||
//协议栈初始化在提示音结束进行
|
||||
} else {
|
||||
//后台返回的情况没有播放提示音,需要在这里进行协议栈的resume
|
||||
// 协议栈初始化在提示音结束进行
|
||||
}
|
||||
else
|
||||
{
|
||||
// 后台返回的情况没有播放提示音,需要在这里进行协议栈的resume
|
||||
bt_task_start();
|
||||
}
|
||||
#if TCFG_DEC2TWS_ENABLE
|
||||
extern void set_tws_background_connected_flag(u8 flag);
|
||||
if (get_tws_background_connected_flag()) {
|
||||
if (get_tws_background_connected_flag())
|
||||
{
|
||||
int state = tws_api_get_tws_state();
|
||||
if (state & TWS_STA_SIBLING_CONNECTED) {
|
||||
if (tws_api_get_role() == TWS_ROLE_MASTER) {
|
||||
if (state & TWS_STA_SIBLING_CONNECTED)
|
||||
{
|
||||
if (tws_api_get_role() == TWS_ROLE_MASTER)
|
||||
{
|
||||
app_task_switch_back();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
set_tws_background_connected_flag(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
start_led();
|
||||
|
||||
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 (bt_sys_event_handler((struct sys_event *)(msg + 1)) == false) {
|
||||
if (bt_sys_event_handler((struct sys_event *)(msg + 1)) == false)
|
||||
{
|
||||
app_default_event_deal((struct sys_event *)(&msg[1]));
|
||||
}
|
||||
break;
|
||||
@ -1185,32 +1296,40 @@ void app_bt_task()
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if TCFG_BLUETOOTH_BACK_MODE
|
||||
if (!__this->init_ok && !app_var.goto_poweroff_flag) {
|
||||
//蓝牙后台方案必须要等待协议栈初始化完成
|
||||
if (!__this->init_ok && !app_var.goto_poweroff_flag)
|
||||
{
|
||||
// 蓝牙后台方案必须要等待协议栈初始化完成
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
if (__this->init_start && (!__this->init_ok)) { //协议栈已经初始化 但没有初始化完成
|
||||
//需要等待初始化完成才可以走退出流程
|
||||
if (__this->init_start && (!__this->init_ok))
|
||||
{ // 协议栈已经初始化 但没有初始化完成
|
||||
// 需要等待初始化完成才可以走退出流程
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (app_task_exitting()) {
|
||||
if (__this->init_start) {
|
||||
if (app_task_exitting())
|
||||
{
|
||||
sys_timer_del(tm_led);
|
||||
gpio_set_output_value(IO_PORTB_05, 1);
|
||||
if (__this->init_start)
|
||||
{
|
||||
bt_task_close();
|
||||
__this->wait_exit = 1;
|
||||
} else { //蓝牙协议栈没有初始化,可以直接退出
|
||||
}
|
||||
else
|
||||
{ // 蓝牙协议栈没有初始化,可以直接退出
|
||||
bt_task_close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (__this->wait_exit) { //开始退出
|
||||
if (!__this->exiting) { ///等待蓝牙退出处理完成
|
||||
if (__this->wait_exit)
|
||||
{ // 开始退出
|
||||
if (!__this->exiting)
|
||||
{ /// 等待蓝牙退出处理完成
|
||||
__this->wait_exit = 0;
|
||||
return;
|
||||
}
|
||||
@ -1239,7 +1358,6 @@ int bt_background_event_handler_filter(struct sys_event *event)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
u8 get_call_status()
|
||||
{
|
||||
return BT_CALL_HANGUP;
|
||||
|
@ -40,8 +40,6 @@
|
||||
|
||||
**************************************************************/
|
||||
|
||||
|
||||
|
||||
#if TCFG_APP_FM_EN
|
||||
|
||||
static u8 fm_idle_flag = 1;
|
||||
@ -53,6 +51,54 @@ u8 *get_vm_spi_code_run_addr()
|
||||
return vm_spi_code_run_addr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static u16 tm_led;
|
||||
static int t_cnt;
|
||||
static u8 led_flag;
|
||||
|
||||
|
||||
static void led_cb(void *priv)
|
||||
{
|
||||
|
||||
if (fm_get_play_statue() == 0)
|
||||
{
|
||||
t_cnt++;
|
||||
if (t_cnt > 1)
|
||||
{
|
||||
t_cnt = 0;
|
||||
if (led_flag == 1)
|
||||
{
|
||||
led_flag = 0;
|
||||
gpio_set_output_value(IO_PORTB_05, led_flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
led_flag = 1;
|
||||
gpio_set_output_value(IO_PORTB_05, led_flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
led_flag = 1;
|
||||
gpio_set_output_value(IO_PORTB_05, led_flag);
|
||||
}
|
||||
}
|
||||
|
||||
static void start_led(void)
|
||||
{
|
||||
if (tm_led)
|
||||
{
|
||||
sys_timer_del(tm_led);
|
||||
}
|
||||
|
||||
t_cnt = 0;
|
||||
led_flag = 1;
|
||||
tm_led = sys_timer_add(NULL, led_cb, 250);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief fm按键消息入口
|
||||
@param 无
|
||||
@ -67,48 +113,50 @@ static int fm_key_event_opr(struct sys_event *event)
|
||||
struct key_event *key = &event->u.key;
|
||||
|
||||
int key_event = event->u.key.event;
|
||||
int key_value = event->u.key.value;//
|
||||
int key_value = event->u.key.value; //
|
||||
|
||||
r_printf("key value:%d, event:%d \n", key->value, key->event);
|
||||
|
||||
#if (TCFG_SPI_LCD_ENABLE)
|
||||
extern int key_is_ui_takeover();
|
||||
if (key_is_ui_takeover()) {
|
||||
if (key_is_ui_takeover())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (key_event) {
|
||||
switch (key_event)
|
||||
{
|
||||
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: // 暂停播放
|
||||
/* app_task_put_key_msg(KEY_TEST_DEMO_0,1234); //test demo// */
|
||||
fm_volume_pp();
|
||||
break;
|
||||
case KEY_FM_SCAN_ALL://全自动搜台
|
||||
case KEY_FM_SCAN_ALL_DOWN://全自动搜台
|
||||
case KEY_FM_SCAN_ALL_UP://全自动搜台
|
||||
case KEY_FM_SCAN_ALL: // 全自动搜台
|
||||
case KEY_FM_SCAN_ALL_DOWN: // 全自动搜台
|
||||
case KEY_FM_SCAN_ALL_UP: // 全自动搜台
|
||||
fm_scan_all();
|
||||
break;
|
||||
case KEY_FM_SCAN_DOWN:
|
||||
fm_scan_down();//半自动搜台
|
||||
fm_scan_down(); // 半自动搜台
|
||||
break;
|
||||
case KEY_FM_SCAN_UP:
|
||||
fm_scan_up();//半自动搜台
|
||||
fm_scan_up(); // 半自动搜台
|
||||
break;
|
||||
case KEY_FM_PREV_STATION://下一台
|
||||
case KEY_FM_PREV_STATION: // 下一台
|
||||
fm_prev_station();
|
||||
break;
|
||||
case KEY_FM_NEXT_STATION:
|
||||
fm_next_station();
|
||||
break;
|
||||
case KEY_FM_PREV_FREQ://下一个频率
|
||||
case KEY_FM_PREV_FREQ: // 下一个频率
|
||||
fm_prev_freq();
|
||||
break;
|
||||
case KEY_FM_NEXT_FREQ:
|
||||
@ -138,8 +186,6 @@ static int fm_key_event_opr(struct sys_event *event)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief fm 模式活跃状态 所有消息入口
|
||||
@param 无
|
||||
@ -151,16 +197,21 @@ static int fm_key_event_opr(struct sys_event *event)
|
||||
static int fm_event_handler(struct sys_event *event)
|
||||
{
|
||||
int err = 0;
|
||||
switch (event->type) {
|
||||
switch (event->type)
|
||||
{
|
||||
case SYS_KEY_EVENT:
|
||||
return fm_key_event_opr(event);
|
||||
break;
|
||||
|
||||
case SYS_DEVICE_EVENT:
|
||||
if ((u32)event->arg == DEVICE_EVENT_FROM_FM) {
|
||||
if (event->u.dev.event == DEVICE_EVENT_IN) {
|
||||
if ((u32)event->arg == DEVICE_EVENT_FROM_FM)
|
||||
{
|
||||
if (event->u.dev.event == DEVICE_EVENT_IN)
|
||||
{
|
||||
log_info("fm online \n");
|
||||
} else if (event->u.dev.event == DEVICE_EVENT_OUT) {
|
||||
}
|
||||
else if (event->u.dev.event == DEVICE_EVENT_OUT)
|
||||
{
|
||||
log_info("fm offline \n");
|
||||
app_task_switch_next();
|
||||
}
|
||||
@ -191,14 +242,16 @@ static void fm_app_init(void)
|
||||
int code_size = __movable_region2_start - __movable_region_start;
|
||||
printf("code_size:%d\n", code_size);
|
||||
mem_stats();
|
||||
if (code_size && fm_code_run_addr == NULL) {
|
||||
if (code_size && fm_code_run_addr == NULL)
|
||||
{
|
||||
#if TCFG_CODE_RUN_OVERLAY_FM_MODE
|
||||
fm_code_run_addr = __fm_overlay_movable_saddr;
|
||||
#else
|
||||
fm_code_run_addr = phy_malloc(code_size);
|
||||
#endif
|
||||
}
|
||||
if (fm_code_run_addr) {
|
||||
if (fm_code_run_addr)
|
||||
{
|
||||
printf("fm_code_run_addr:0x%x", fm_code_run_addr);
|
||||
code_movable_load(__movable_region_start, code_size, fm_code_run_addr, __app_movable_slot_start, __app_movable_slot2_start, &start_of_region_fm);
|
||||
mem_stats();
|
||||
@ -208,10 +261,12 @@ static void fm_app_init(void)
|
||||
#if TCFG_VM_SPI_CODE_AT_RAM_DYANMIC
|
||||
int code_size1 = __movable_region4_start - __movable_region3_start;
|
||||
printf("code_size1:%d\n", code_size1);
|
||||
if (code_size1 && vm_spi_code_run_addr == NULL) {
|
||||
if (code_size1 && vm_spi_code_run_addr == NULL)
|
||||
{
|
||||
vm_spi_code_run_addr = phy_malloc(code_size1);
|
||||
}
|
||||
if (vm_spi_code_run_addr) {
|
||||
if (vm_spi_code_run_addr)
|
||||
{
|
||||
printf("vm_spi_code_run_addr:0x%x", vm_spi_code_run_addr);
|
||||
code_movable_load(__movable_region3_start, code_size1, vm_spi_code_run_addr, __app_movable_slot3_start, __app_movable_slot4_start, &start_of_region_spi);
|
||||
}
|
||||
@ -220,14 +275,13 @@ static void fm_app_init(void)
|
||||
sys_key_event_enable();
|
||||
ui_update_status(STATUS_FM_MODE);
|
||||
clock_idle(FM_IDLE_CLOCK);
|
||||
fm_manage_init();//
|
||||
fm_api_init();//设置频率信息
|
||||
fm_manage_init(); //
|
||||
fm_api_init(); // 设置频率信息
|
||||
}
|
||||
|
||||
|
||||
static void fm_app_start(void)
|
||||
{
|
||||
fm_manage_start();//收音出声
|
||||
fm_manage_start(); // 收音出声
|
||||
}
|
||||
|
||||
static void fm_app_uninit(void)
|
||||
@ -238,7 +292,8 @@ static void fm_app_uninit(void)
|
||||
tone_play_stop_by_path(tone_table[IDEX_TONE_FM]);
|
||||
fm_idle_flag = 1;
|
||||
#if TCFG_CODE_RUN_RAM_FM_MODE
|
||||
if (fm_code_run_addr) {
|
||||
if (fm_code_run_addr)
|
||||
{
|
||||
mem_stats();
|
||||
code_movable_unload(__movable_region_start, __app_movable_slot_start, __app_movable_slot2_start, &start_of_region_fm);
|
||||
#if (!TCFG_CODE_RUN_OVERLAY_FM_MODE)
|
||||
@ -250,7 +305,8 @@ static void fm_app_uninit(void)
|
||||
#endif
|
||||
|
||||
#if TCFG_VM_SPI_CODE_AT_RAM_DYANMIC
|
||||
if (vm_spi_code_run_addr) {
|
||||
if (vm_spi_code_run_addr)
|
||||
{
|
||||
code_movable_unload(__movable_region3_start, __app_movable_slot3_start, __app_movable_slot4_start, &start_of_region_spi);
|
||||
phy_free(vm_spi_code_run_addr);
|
||||
vm_spi_code_run_addr = NULL;
|
||||
@ -258,19 +314,20 @@ static void fm_app_uninit(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void fm_tone_play_end_callback(void *priv, int flag)
|
||||
{
|
||||
u32 index = (u32)priv;
|
||||
|
||||
if (APP_FM_TASK != app_get_curr_task()) {
|
||||
if (APP_FM_TASK != app_get_curr_task())
|
||||
{
|
||||
log_error("tone callback task out \n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (index) {
|
||||
switch (index)
|
||||
{
|
||||
case IDEX_TONE_FM:
|
||||
///提示音播放结束, 启动播放器播放
|
||||
/// 提示音播放结束, 启动播放器播放
|
||||
fm_app_start();
|
||||
break;
|
||||
default:
|
||||
@ -290,10 +347,12 @@ int fm_close_bt()
|
||||
{
|
||||
int flag;
|
||||
int msg[32];
|
||||
//fm和蓝牙共用模拟,后台时需要进入的时候关闭蓝牙
|
||||
|
||||
// fm和蓝牙共用模拟,后台时需要进入的时候关闭蓝牙
|
||||
flag = bt_background_close_bt_hardward(1);
|
||||
if (flag != 0) {
|
||||
//搞个消息获取驱动sys timer的执行
|
||||
if (flag != 0)
|
||||
{
|
||||
// 搞个消息获取驱动sys timer的执行
|
||||
app_task_get_msg(msg, ARRAY_SIZE(msg), 1);
|
||||
}
|
||||
return flag;
|
||||
@ -306,37 +365,53 @@ void app_fm_task()
|
||||
if (fm_close_bt() != 0) {
|
||||
return;
|
||||
}*/
|
||||
// PA mode set to class AB
|
||||
gpio_set_pull_down(IO_PORTA_02, 0);
|
||||
gpio_set_pull_up(IO_PORTA_02, 0);
|
||||
gpio_set_direction(IO_PORTA_02, 0);
|
||||
gpio_set_output_value(IO_PORTA_02, 1);
|
||||
fm_app_init();
|
||||
#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())
|
||||
{ // 不播放提示音
|
||||
fm_app_start();
|
||||
set_tws_background_connected_flag(0);
|
||||
} else
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
tone_play_with_callback_by_name(tone_table[IDEX_TONE_FM], 1, fm_tone_play_end_callback, (void *)IDEX_TONE_FM);
|
||||
}
|
||||
// if (err) {
|
||||
// ///提示音播放失败,直接启动播放
|
||||
// fm_app_start();
|
||||
// }
|
||||
// if (err) {
|
||||
// ///提示音播放失败,直接启动播放
|
||||
// fm_app_start();
|
||||
// }
|
||||
|
||||
while (1) {
|
||||
start_led();
|
||||
|
||||
while (1)
|
||||
{
|
||||
app_task_get_msg(msg, ARRAY_SIZE(msg), 1);
|
||||
|
||||
switch (msg[0]) {
|
||||
switch (msg[0])
|
||||
{
|
||||
case APP_MSG_SYS_EVENT:
|
||||
if (fm_event_handler((struct sys_event *)(&msg[1])) == false) {
|
||||
app_default_event_deal((struct sys_event *)(&msg[1])); //由common统一处理
|
||||
if (fm_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())
|
||||
{
|
||||
sys_timer_del(tm_led);
|
||||
gpio_set_output_value(IO_PORTB_05, 1);
|
||||
|
||||
fm_app_uninit();
|
||||
return;
|
||||
}
|
||||
@ -354,13 +429,8 @@ REGISTER_LP_TARGET(fm_lp_target) = {
|
||||
|
||||
#else
|
||||
|
||||
|
||||
void app_fm_task()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -418,6 +418,11 @@ void fm_scan_all()
|
||||
sys_timeout_add(NULL, __fm_scan_all, 20);
|
||||
}
|
||||
|
||||
u8 fm_get_play_statue(void)
|
||||
{
|
||||
return __this->fm_dev_mute;
|
||||
|
||||
}
|
||||
void fm_volume_pp(void)
|
||||
{
|
||||
log_info("KEY_MUSIC_PP\n");
|
||||
|
@ -67,7 +67,53 @@
|
||||
static u8 linein_last_onoff = (u8) - 1;
|
||||
static u8 linein_bt_back_flag = 0;
|
||||
static u8 linein_idle_flag = 1;
|
||||
//-----------------------------------------------------------------------------
|
||||
static u16 tm_led;
|
||||
static int t_cnt;
|
||||
static u8 led_flag;
|
||||
|
||||
|
||||
static void led_cb(void *priv)
|
||||
{
|
||||
|
||||
if (linein_get_status() == 1)
|
||||
{
|
||||
t_cnt++;
|
||||
if (t_cnt > 1)
|
||||
{
|
||||
t_cnt = 0;
|
||||
if (led_flag == 1)
|
||||
{
|
||||
led_flag = 0;
|
||||
gpio_set_output_value(IO_PORTB_05, led_flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
led_flag = 1;
|
||||
gpio_set_output_value(IO_PORTB_05, led_flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
led_flag = 1;
|
||||
gpio_set_output_value(IO_PORTB_05, led_flag);
|
||||
}
|
||||
}
|
||||
|
||||
static void start_led(void)
|
||||
{
|
||||
if (tm_led)
|
||||
{
|
||||
sys_timer_del(tm_led);
|
||||
}
|
||||
|
||||
t_cnt = 0;
|
||||
led_flag = 1;
|
||||
tm_led = sys_timer_add(NULL, led_cb, 250);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
///*----------------------------------------------------------------------------*/
|
||||
/**@brief 当前出于非linein 模式时候linein的在common消息处理
|
||||
@param 无
|
||||
@ -296,6 +342,14 @@ void app_linein_task()
|
||||
int err = 0;
|
||||
int msg[32];
|
||||
|
||||
|
||||
|
||||
// PA mode set to class D
|
||||
gpio_set_pull_down(IO_PORTA_02, 0);
|
||||
gpio_set_pull_up(IO_PORTA_02, 0);
|
||||
gpio_set_direction(IO_PORTA_02, 0);
|
||||
gpio_set_output_value(IO_PORTA_02,0);
|
||||
|
||||
#if TCFG_APP_BT_EN
|
||||
linein_bt_back_flag = get_bt_back_flag();//从蓝牙后台返回标志
|
||||
set_bt_back_flag(0);
|
||||
@ -323,6 +377,7 @@ void app_linein_task()
|
||||
// ///提示音播放失败,直接推送KEY_MUSIC_PLAYER_START启动播放
|
||||
// app_task_put_key_msg(KEY_LINEIN_START, 0);
|
||||
// }
|
||||
start_led();
|
||||
|
||||
while (1) {
|
||||
app_task_get_msg(msg, ARRAY_SIZE(msg), 1);
|
||||
@ -338,6 +393,8 @@ void app_linein_task()
|
||||
}
|
||||
|
||||
if (app_task_exitting()) {
|
||||
sys_timer_del(tm_led);
|
||||
gpio_set_output_value(IO_PORTB_05, 1);
|
||||
linein_task_close();
|
||||
return;
|
||||
}
|
||||
|
@ -277,6 +277,8 @@ void linein_stop(void)
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
int linein_volume_pp(void)
|
||||
{
|
||||
if (__this->onoff) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -132,9 +132,9 @@ void app_poweron_task()
|
||||
|
||||
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(); /* */
|
||||
/* } */
|
||||
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
||||
*/
|
||||
#if (TCFG_AUDIO_DAC_CONNECT_MODE == DAC_OUTPUT_MONO_LR_DIFF || \
|
||||
TCFG_AUDIO_DAC_CONNECT_MODE == DAC_OUTPUT_DUAL_LR_DIFF)
|
||||
#define MAX_ANA_VOL (21)
|
||||
#define MAX_ANA_VOL (28)
|
||||
#else
|
||||
#define MAX_ANA_VOL (30)
|
||||
#endif/*TCFG_AUDIO_DAC_CONNECT_MODE*/
|
||||
@ -113,8 +113,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define SYS_DEFAULT_VOL 0//(SYS_MAX_VOL/2)
|
||||
#define SYS_DEFAULT_TONE_VOL 10//(SYS_MAX_VOL)
|
||||
#define SYS_DEFAULT_VOL SYS_MAX_VOL/2 //(SYS_MAX_VOL/2)
|
||||
#define SYS_DEFAULT_TONE_VOL 18//(SYS_MAX_VOL)
|
||||
#define SYS_DEFAULT_SIN_VOL 17
|
||||
|
||||
#define APP_AUDIO_STATE_IDLE 0
|
||||
|
@ -946,7 +946,16 @@ REGISTER_LP_TARGET(audio_dec_init_lp_target) = {
|
||||
|
||||
void audio_mix_out_automute_mute(u8 mute)
|
||||
{
|
||||
printf(">>>>>>>>>>>>>>>>>>>> %s\n", mute ? ("MUTE") : ("UNMUTE"));
|
||||
//printf(">>>>>>>>>>>>>>>>>>>> %s\n", mute ? ("MUTE") : ("UNMUTE"));
|
||||
if (mute)
|
||||
{
|
||||
gpio_set_output_value(IO_PORTA_04,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gpio_set_output_value(IO_PORTA_04,0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* #define AUDIO_E_DET_UNMUTE (0x00) */
|
||||
|
@ -37,22 +37,8 @@ mp3_decoder
|
||||
|
||||
wma_decoder
|
||||
g729_decoder
|
||||
wav_decoder
|
||||
cvsd_encoder
|
||||
|
||||
|
||||
|
||||
msbc_encoder
|
||||
|
||||
|
||||
|
||||
mp3_encoder
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
adpcm_encoder
|
||||
sbc_encoder
|
||||
|
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.
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
1
cpu/br25/tools/soundbox/standard/KTS_AC690x_5458.key
Normal file
1
cpu/br25/tools/soundbox/standard/KTS_AC690x_5458.key
Normal file
@ -0,0 +1 @@
|
||||
44b10a8a9a97a7ea8795ce48fe8bb180954fc20c5763ded5954fc20c5763ded5399f4f1d
|
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -7,13 +7,13 @@ copy ..\..\uboot.boot .
|
||||
copy ..\..\ota.bin .
|
||||
copy ..\..\eq_cfg_hw.bin .
|
||||
|
||||
..\..\isd_download.exe -tonorflash -dev br25 -boot 0x12000 -div8 -wait 300 -uboot uboot.boot -app app.bin -res tone.cfg cfg_tool.bin eq_cfg_hw.bin -uboot_compress
|
||||
..\..\isd_download.exe -tonorflash -dev br25 -boot 0x12000 -div8 -wait 300 -uboot uboot.boot -app app.bin -res tone.cfg cfg_tool.bin eq_cfg_hw.bin -uboot_compress -key KTS_AC690x_5458.key
|
||||
:: -format all
|
||||
::-reboot 2500
|
||||
|
||||
|
||||
|
||||
@rem 删除临时文件-format all
|
||||
@rem ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD>-format all
|
||||
if exist *.mp3 del *.mp3
|
||||
if exist *.PIX del *.PIX
|
||||
if exist *.TAB del *.TAB
|
||||
@ -26,16 +26,16 @@ copy jl_isd.ufw update.ufw
|
||||
del jl_isd.ufw
|
||||
|
||||
|
||||
@REM 生成配置文件升级文件
|
||||
@REM <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
::ufw_maker.exe -chip AC800X %ADD_KEY% -output config.ufw -res bt_cfg.cfg
|
||||
|
||||
::IF EXIST jl_696x.bin del jl_696x.bin
|
||||
|
||||
|
||||
@rem 常用命令说明
|
||||
@rem -format vm //擦除VM 区域
|
||||
@rem -format cfg //擦除BT CFG 区域
|
||||
@rem -format 0x3f0-2 //表示从第 0x3f0 个 sector 开始连续擦除 2 个 sector(第一个参数为16进制或10进制都可,第二个参数必须是10进制)
|
||||
@rem <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD>
|
||||
@rem -format vm //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>VM <20><><EFBFBD><EFBFBD>
|
||||
@rem -format cfg //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>BT CFG <20><><EFBFBD><EFBFBD>
|
||||
@rem -format 0x3f0-2 //<EFBFBD><EFBFBD>ʾ<EFBFBD>ӵ<EFBFBD> 0x3f0 <20><> sector <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 <20><> sector(<28><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ16<31><36><EFBFBD>ƻ<EFBFBD>10<31><30><EFBFBD>ƶ<EFBFBD><C6B6>ɣ<EFBFBD><C9A3>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>10<31><30><EFBFBD><EFBFBD>)
|
||||
|
||||
ping /n 2 127.1>null
|
||||
IF EXIST null del null
|
||||
|
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/br25/tools/soundbox/standard/extra_tones/tf.wtg
Normal file
BIN
cpu/br25/tools/soundbox/standard/extra_tones/tf.wtg
Normal file
Binary file not shown.
BIN
cpu/br25/tools/soundbox/standard/extra_tones/usb.wtg
Normal file
BIN
cpu/br25/tools/soundbox/standard/extra_tones/usb.wtg
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
BIN
tone/bt.mp3
Normal file
BIN
tone/bt.mp3
Normal file
Binary file not shown.
BIN
tone/bt.wtg
Normal file
BIN
tone/bt.wtg
Normal file
Binary file not shown.
BIN
tone/connect.mp3
Normal file
BIN
tone/connect.mp3
Normal file
Binary file not shown.
BIN
tone/connect.wtg
Normal file
BIN
tone/connect.wtg
Normal file
Binary file not shown.
BIN
tone/disconnect.mp3
Normal file
BIN
tone/disconnect.mp3
Normal file
Binary file not shown.
BIN
tone/disconnect.wtg
Normal file
BIN
tone/disconnect.wtg
Normal file
Binary file not shown.
BIN
tone/linein.mp3
Normal file
BIN
tone/linein.mp3
Normal file
Binary file not shown.
BIN
tone/linein.wtg
Normal file
BIN
tone/linein.wtg
Normal file
Binary file not shown.
BIN
tone/low_power.mp3
Normal file
BIN
tone/low_power.mp3
Normal file
Binary file not shown.
BIN
tone/low_power.wtg
Normal file
BIN
tone/low_power.wtg
Normal file
Binary file not shown.
BIN
tone/pwr_off.mp3
Normal file
BIN
tone/pwr_off.mp3
Normal file
Binary file not shown.
BIN
tone/pwr_off.wtg
Normal file
BIN
tone/pwr_off.wtg
Normal file
Binary file not shown.
BIN
tone/radio.mp3
Normal file
BIN
tone/radio.mp3
Normal file
Binary file not shown.
BIN
tone/radio.wtg
Normal file
BIN
tone/radio.wtg
Normal file
Binary file not shown.
BIN
tone/tf.mp3
Normal file
BIN
tone/tf.mp3
Normal file
Binary file not shown.
BIN
tone/tf.wtg
Normal file
BIN
tone/tf.wtg
Normal file
Binary file not shown.
BIN
tone/usb.mp3
Normal file
BIN
tone/usb.mp3
Normal file
Binary file not shown.
BIN
tone/usb.wtg
Normal file
BIN
tone/usb.wtg
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user