Compare commits

..

No commits in common. "d9902acf4388349563439309d1fe10e158ad852d" and "bcc29aa0a8fead12d05e43a492aa4f4f28e8471d" have entirely different histories.

7 changed files with 45 additions and 82 deletions

View File

@ -23,12 +23,3 @@ In order to program the buds from inside of the docker container; privileged mod
bestool write-image out/open_source/open_source.bin --port /dev/ttyACM0 bestool write-image out/open_source/open_source.bin --port /dev/ttyACM0
bestool write-image out/open_source/open_source.bin --port /dev/ttyACM1 bestool write-image out/open_source/open_source.bin --port /dev/ttyACM1
``` ```
## Changelist from stock opeen source SDK
+ Long hold (5 ish seconds) the button on the back when buds are in the case to force a device reboot (so it can be programmed)
+ Use the resistor in the buds to pick Left/Right rather than TWS master/slave pairing
+ Pressing the button on the back while in the case no longer triggers DFU mode
+ Debugging baud rate raised to 200000 to match stock firmware

View File

@ -1396,17 +1396,12 @@ void app_key_init(void)
} }
#endif #endif
} }
void app_key_reboot(APP_KEY_STATUS *status, void *param)
{
TRACE(1,"%s ",__func__);
hal_cmu_sys_reboot();
}
void app_key_init_on_charging(void) void app_key_init_on_charging(void)
{ {
uint8_t i = 0; uint8_t i = 0;
const APP_KEY_HANDLE key_cfg[] = { const APP_KEY_HANDLE key_cfg[] = {
{{APP_KEY_CODE_PWR,APP_KEY_EVENT_LONGLONGPRESS},"long press reboot",app_key_reboot, NULL}, // {{APP_KEY_CODE_PWR,APP_KEY_EVENT_REPEAT},"ota function key",app_ota_key_handler, NULL},
// {{APP_KEY_CODE_PWR,APP_KEY_EVENT_CLICK},"bt function key",app_dfu_key_handler, NULL}, // {{APP_KEY_CODE_PWR,APP_KEY_EVENT_CLICK},"bt function key",app_dfu_key_handler, NULL},
#ifdef __USB_COMM__ #ifdef __USB_COMM__
{{APP_KEY_CODE_PWR,APP_KEY_EVENT_LONGPRESS},"usb cdc key",app_usb_cdc_comm_key_handler, NULL}, {{APP_KEY_CODE_PWR,APP_KEY_EVENT_LONGPRESS},"usb cdc key",app_usb_cdc_comm_key_handler, NULL},
@ -2233,7 +2228,7 @@ int app_init(void)
TRACE(2,"__factory_start: %p length: 0x%x", __factory_start, FACTORY_SECTION_SIZE); TRACE(2,"__factory_start: %p length: 0x%x", __factory_start, FACTORY_SECTION_SIZE);
TRACE(0,"app_init\n"); TRACE(0,"app_init\n");
app_tws_set_side_from_gpio();
#ifdef __RPC_ENABLE__ #ifdef __RPC_ENABLE__
extern int rpc_service_setup(void); extern int rpc_service_setup(void);
rpc_service_setup(); rpc_service_setup();

View File

@ -10,7 +10,7 @@ RTOS ?= 1
#KERNEL ?= FREERTOS #KERNEL ?= FREERTOS
NO_PWRKEY = 0 # We have powerkey input
LIBC_ROM ?= 1 LIBC_ROM ?= 1
export USER_SECURE_BOOT ?= 0 export USER_SECURE_BOOT ?= 0
@ -45,7 +45,7 @@ export CONTROLLER_DUMP_ENABLE ?= 0
export CONTROLLER_MEM_LOG_ENABLE ?= 0 export CONTROLLER_MEM_LOG_ENABLE ?= 0
export INTERSYS_DEBUG ?= 0 export INTERSYS_DEBUG ?= 1
export PROFILE_DEBUG ?= 0 export PROFILE_DEBUG ?= 0
@ -209,7 +209,7 @@ CUSTOM_INFORMATION_TILE_ENABLE ?= 0
INTERCONNECTION ?= 0 INTERCONNECTION ?= 0
INTERACTION ?= 0 # Looks like Find-My-Device support? INTERACTION ?= 0
INTERACTION_FASTPAIR ?= 0 INTERACTION_FASTPAIR ?= 0
@ -258,7 +258,7 @@ export A2DP_AVDTP_CP ?= 0
export A2DP_DECODER_VER := 2 export A2DP_DECODER_VER := 2
export IBRT = 1 export IBRT ?= 1
export IBRT_SEARCH_UI ?= 1 export IBRT_SEARCH_UI ?= 1
@ -350,7 +350,7 @@ AUDIO_BUFFER_SIZE := 100*1024
endif endif
export TRACE_BUF_SIZE := 16*1024 export TRACE_BUF_SIZE := 16*1024
export TRACE_BAUD_RATE := 2000000 export TRACE_BAUD_RATE := 921600
init-y := init-y :=
core-y := platform/ services/ apps/ utils/cqueue/ utils/list/ services/multimedia/ utils/intersyshci/ core-y := platform/ services/ apps/ utils/cqueue/ utils/list/ services/multimedia/ utils/intersyshci/

View File

@ -82,7 +82,7 @@ const struct HAL_KEY_GPIOKEY_CFG_T cfg_hw_gpio_key_cfg[CFG_HW_GPIOKEY_NUM] = {
#endif #endif
#endif #endif
*/ */
// {HAL_KEY_CODE_FN1,{HAL_IOMUX_PIN_P1_5, HAL_IOMUX_FUNC_AS_GPIO, HAL_IOMUX_PIN_VOLTAGE_VIO, HAL_IOMUX_PIN_PULLUP_ENABLE}}, {HAL_KEY_CODE_FN1,{HAL_IOMUX_PIN_P1_5, HAL_IOMUX_FUNC_AS_GPIO, HAL_IOMUX_PIN_VOLTAGE_VIO, HAL_IOMUX_PIN_PULLUP_ENABLE}},
}; };
//bt config //bt config
@ -104,23 +104,6 @@ uint8_t bt_addr[6] = {
#endif #endif
}; };
const struct HAL_IOMUX_PIN_FUNCTION_MAP cfg_hw_tws_channel_cfg = {
HAL_IOMUX_PIN_P1_4, HAL_IOMUX_FUNC_AS_GPIO, HAL_IOMUX_PIN_VOLTAGE_VIO, HAL_IOMUX_PIN_PULLUP_ENABLE
};
bool tgt_tws_get_channel_is_right(void)
{
#ifdef __FIXED_TWS_EAR_SIDE__
return TWS_EAR_SIDE_ROLE;
#else
hal_iomux_init((struct HAL_IOMUX_PIN_FUNCTION_MAP *)&cfg_hw_tws_channel_cfg,1);
// Pinebuds pull down to 0 for right ear, but float to 1 for left ear
return (hal_gpio_pin_get_val(
(enum HAL_GPIO_PIN_T)cfg_hw_tws_channel_cfg.pin) == 0);
#endif
}
//audio config //audio config
//freq bands range {[0k:2.5K], [2.5k:5K], [5k:7.5K], [7.5K:10K], [10K:12.5K], [12.5K:15K], [15K:17.5K], [17.5K:20K]} //freq bands range {[0k:2.5K], [2.5k:5K], [5k:7.5K], [7.5K:10K], [10K:12.5K], [12.5K:15K], [15K:17.5K], [17.5K:20K]}
//gain range -12~+12 //gain range -12~+12
@ -198,13 +181,13 @@ const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_INT ={
}; };
*/ */
// const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SDA ={ const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SDA ={
// HAL_IOMUX_PIN_P2_1, HAL_IOMUX_FUNC_AS_GPIO, HAL_IOMUX_PIN_VOLTAGE_VIO, HAL_IOMUX_PIN_PULLUP_ENABLE HAL_IOMUX_PIN_P2_1, HAL_IOMUX_FUNC_AS_GPIO, HAL_IOMUX_PIN_VOLTAGE_VIO, HAL_IOMUX_PIN_PULLUP_ENABLE
// }; };
// const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SCL ={ const struct HAL_IOMUX_PIN_FUNCTION_MAP TOUCH_I2C_SCL ={
// HAL_IOMUX_PIN_P2_0, HAL_IOMUX_FUNC_AS_GPIO, HAL_IOMUX_PIN_VOLTAGE_VIO, HAL_IOMUX_PIN_PULLUP_ENABLE HAL_IOMUX_PIN_P2_0, HAL_IOMUX_FUNC_AS_GPIO, HAL_IOMUX_PIN_VOLTAGE_VIO, HAL_IOMUX_PIN_PULLUP_ENABLE
// }; };
@ -336,6 +319,10 @@ Filter4_A=[ 134217728, -264794659, 130668486];
}, },
*/ */
.dac_gain_offset=0, .dac_gain_offset=0,
.adc_gain_offset=(0)*4, .adc_gain_offset=(0)*4,
}, },

View File

@ -76,7 +76,7 @@ extern const uint16_t CFG_HW_ADCKEY_MAP_TABLE[CFG_HW_ADCKEY_NUMBER];
#elif BES_AUDIO_DEV_Main_Board_9v0 #elif BES_AUDIO_DEV_Main_Board_9v0
#define CFG_HW_GPIOKEY_NUM (6) #define CFG_HW_GPIOKEY_NUM (6)
#else #else
#define CFG_HW_GPIOKEY_NUM (0) #define CFG_HW_GPIOKEY_NUM (1)
#endif #endif
#endif #endif

View File

@ -15,7 +15,6 @@
****************************************************************************/ ****************************************************************************/
#include <string.h> #include <string.h>
#include "app_tws_ibrt_trace.h" #include "app_tws_ibrt_trace.h"
#include "app_tws_if.h"
#include "bluetooth.h" #include "bluetooth.h"
#include "btapp.h" #include "btapp.h"
#include "app_ibrt_ui.h" #include "app_ibrt_ui.h"
@ -211,27 +210,22 @@ void app_bt_manager_ibrt_role_process(const btif_event_t *Event)
{ {
memcpy(p_ibrt_ctrl->local_addr.address,p_remote_dev_addr->address,6); memcpy(p_ibrt_ctrl->local_addr.address,p_remote_dev_addr->address,6);
} }
if (app_tws_is_left_side()){
p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_LCHNL; #if 0
}else { p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_LRMERGE;
#else
if(IBRT_MASTER == p_ibrt_ctrl->nv_role)
{
TRACE(0,"#right");
p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_RCHNL; p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_RCHNL;
} }
else if(IBRT_SLAVE == p_ibrt_ctrl->nv_role)
{
TRACE(0,"#left");
p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_LCHNL;
// #if 0 }
// p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_LRMERGE; #endif
// #else
// if(IBRT_MASTER == p_ibrt_ctrl->nv_role)
// {
// TRACE(0,"#right");
// p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_RCHNL;
// }
// else if(IBRT_SLAVE == p_ibrt_ctrl->nv_role)
// {
// TRACE(0,"#left");
// p_ibrt_ctrl->audio_chnl_sel = A2DP_AUDIO_CHANNEL_SELECT_LCHNL;
// }
// #endif
} }
} }

View File

@ -663,7 +663,6 @@ static APP_TWS_SIDE_T app_tws_side = EAR_SIDE_UNKNOWN;
void app_tws_set_side(APP_TWS_SIDE_T side) void app_tws_set_side(APP_TWS_SIDE_T side)
{ {
ASSERT((EAR_SIDE_LEFT == side) || (EAR_SIDE_RIGHT == side), "Error: setting invalid side"); ASSERT((EAR_SIDE_LEFT == side) || (EAR_SIDE_RIGHT == side), "Error: setting invalid side");
TRACE(1,"Set TWS side to %d",side);
app_tws_side = side; app_tws_side = side;
} }
@ -682,25 +681,22 @@ bool app_tws_is_unknown_side(void)
return (app_tws_side == EAR_SIDE_UNKNOWN); return (app_tws_side == EAR_SIDE_UNKNOWN);
} }
// void app_tws_set_side_from_addr(uint8_t *addr) void app_tws_set_side_from_addr(uint8_t *addr)
// { {
// ASSERT(addr, "Error: address invalid"); ASSERT(addr, "Error: address invalid");
// if (addr[0] & 0x1) { if (addr[0] & 0x1) {
// app_tws_set_side(EAR_SIDE_RIGHT); app_tws_set_side(EAR_SIDE_RIGHT);
// TRACE(0, "Right earbud"); TRACE(0, "Right earbud");
// } else { } else {
// app_tws_set_side(EAR_SIDE_LEFT); app_tws_set_side(EAR_SIDE_LEFT);
// TRACE(0, "Left earbud"); TRACE(0, "Left earbud");
// } }
// } }
void app_tws_set_side_from_gpio(void) void app_tws_set_side_from_gpio(void)
{ {
if (tgt_tws_get_channel_is_right()){
app_tws_set_side(EAR_SIDE_RIGHT);
}else {
app_tws_set_side(EAR_SIDE_LEFT);
}
} }
#endif #endif