remove i2c_control_task

This commit is contained in:
Steven Dan
2026-03-20 16:41:50 +08:00
parent c36a6360c9
commit 78ebebcd43
3 changed files with 4 additions and 117 deletions

View File

@@ -247,7 +247,6 @@ int i2c_codec_mic_vol_down(void)
extern unsigned g_host_os;
extern unsigned g_windows_detect_done;
extern unsigned g_mic_vol_cmd_pending;
extern unsigned g_uac_vol;
extern unsigned g_mute_on_off_t0;
extern unsigned g_game_mode;
@@ -413,93 +412,11 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol)
saved_mode = load_value(path);
debug_printf("Loaded game_mode from flash: %d\n", saved_mode);
#if defined(UAC1_MODE)
if (saved_mode == 255) {
if (saved_mode > 3) {
saved_mode = 0;
save_value(path, saved_mode);
debug_printf("Saved game_mode to flash: %d\n", saved_mode);
}
#else
if (saved_mode == 255) {
#if defined(STEREO_2K)
saved_mode = 0;
#elif defined(SPATIAL_GAME)
saved_mode = 2;
#elif defined(SPATIAL_MOVIE)
saved_mode = 3;
#endif
save_value(path, saved_mode);
debug_printf("Saved game_mode to flash: %d\n", saved_mode);
}
#endif
printf("host_os: %d\n", host_os);
#if 0
if ((host_os == OS_OTHERS) || (host_os == 0)) {
#if !UAC1_MODE
printf("Detected non-Windows OS (OS_OTHERS), switching to UAC1 mode\n");
SetRoleSwitchFlag(MODE_UAC1);
debug_printf("Set role switch flag: 0x%04X (UAC1), device will restart\n", MODE_UAC1);
device_reboot();
while(1);
#endif
}
#endif
#if UAC1_MODE == 1
if (host_os == OS_WIN) {
printf("Detected Windows OS (OS_WIN) saved_mode: %d\n", saved_mode);
#if IR_SWITCHING_MODE
if (saved_mode == 0) {
SetRoleSwitchFlag(MODE_STEREO_2K);
} else {
SetRoleSwitchFlag(MODE_SPATIAL_GAME);
}
#else
{
switch (saved_mode) {
case 0:
SetRoleSwitchFlag(MODE_STEREO_2K);
break;
case 1:
SetRoleSwitchFlag(MODE_STEREO_2K);
break;
case 2:
SetRoleSwitchFlag(MODE_SPATIAL_GAME);
break;
case 3:
SetRoleSwitchFlag(MODE_SPATIAL_MOVIE);
break;
default:
SetRoleSwitchFlag(MODE_STEREO_2K);
break;
}
debug_printf("Switch to saved mode: %d, device will restart.\n", saved_mode);
delay_milliseconds(200);
device_reboot();
while (1);
}
#endif
}
#endif
#if defined(STEREO_2K)
if ((saved_mode != 255) && (saved_mode != 0) && (saved_mode != 1)) {
saved_mode = 0;
}
#endif
#if defined(SPATIAL_GAME)
if ((saved_mode != 255) && (saved_mode != 2)) {
saved_mode = 2;
}
#endif
#if defined(SPATIAL_MOVIE)
if ((saved_mode != 255) && (saved_mode != 3)) {
saved_mode = 3;
}
#endif
g_windows_detect_done = 1;
SET_SHARED_GLOBAL(g_game_mode, saved_mode);
@@ -572,17 +489,14 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol)
case KEY_MIC_VOL_DN:
case KEY_MIC_VOL_UP:
if ((isMute == 0) && ((curr_ctrl_keys & KEY_MIC_VOL_DN) == 0)) {
tmp = KEY_MIC_VOL_DN;
i2c_codec_mic_vol_down();
debug_printf("KEY_MIC_VOL_DN pressed\n");
} else {
if ((isMute == 0) && ((curr_ctrl_keys & KEY_MIC_VOL_UP) == 0)) {
tmp = KEY_MIC_VOL_UP;
i2c_codec_mic_vol_up();
debug_printf("KEY_MIC_VOL_UP pressed\n");
}
}
if (tmp) {
g_mic_vol_cmd_pending = (unsigned)tmp;
}
break;
case KEY_MUTE:
if ((curr_ctrl_keys & KEY_MUTE) == 0) {

View File

@@ -1,5 +1,5 @@
// Copyright 2024 XMOS LIMITED.
#define DEBUG_PRINT_ENABLE 1
#define DEBUG_PRINT_ENABLE 0
#include "debug_print.h"
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#include <print.h>
@@ -23,10 +23,6 @@ void buffer_exchange(chanend_t c_data, unsigned sampsFromUsbToAudio[]) {
#endif
}
extern int i2c_codec_mic_vol_up(void);
extern int i2c_codec_mic_vol_down(void);
extern unsigned g_mic_vol_cmd_pending;
void dsp_main (chanend_t c_data) {
#if EQ_EN
@@ -43,26 +39,4 @@ void dsp_main (chanend_t c_data) {
output[1] = read_from_ring_buffer(3);
}
#endif
}
void i2c_control_task(void) {
delay_milliseconds(500);
while (1) {
delay_milliseconds(10);
if (g_mic_vol_cmd_pending == KEY_MIC_VOL_DN)
{
debug_printf("i2c_codec_mic_vol_down\n");
i2c_codec_mic_vol_down();
debug_printf("i2c_codec_mic_vol_down done\n");
g_mic_vol_cmd_pending = 0;
}
if (g_mic_vol_cmd_pending == KEY_MIC_VOL_UP)
{
debug_printf("i2c_codec_mic_vol_up\n");
i2c_codec_mic_vol_up();
debug_printf("i2c_codec_mic_vol_up done\n");
g_mic_vol_cmd_pending = 0;
}
}
}

View File

@@ -130,7 +130,6 @@ extern void key_receiver(chanend c_key);
{ dsp_core0(); } \
}\
on tile[0]: {dsp_main(c_eq_data); } \
on tile[0]: {i2c_control_task();} \
#endif // AIZIP_DNR