Update UART settings.

This commit is contained in:
sorgelig
2020-04-22 22:59:14 +08:00
parent 72d8831068
commit e59bb17eaa
5 changed files with 30 additions and 16 deletions

View File

@@ -556,6 +556,17 @@ int GetUARTMode()
return 0;
}
int SetUARTMode(int mode)
{
if (is_st()) tos_uart_mode(mode != 3);
MakeFile("/tmp/CORENAME", user_io_get_core_name_ex());
MakeFile("/tmp/UART_SPEED", is_st() ? "19200" : "115200");
char cmd[32];
sprintf(cmd, "uartmode %d", mode & 0xFF);
system(cmd);
}
int GetMidiLinkMode()
{
struct stat filestat;
@@ -568,7 +579,6 @@ int GetMidiLinkMode()
void SetMidiLinkMode(int mode)
{
MakeFile("/tmp/CORENAME", user_io_get_core_name_ex());
remove("/tmp/ML_FSYNTH");
remove("/tmp/ML_MUNT");
remove("/tmp/ML_UDP");
@@ -932,12 +942,9 @@ void user_io_init(const char *path, const char *xml)
FileLoadConfig(mainpath, &mode, 4);
}
char cmd[32];
system("uartmode 0");
SetUARTMode(0);
SetMidiLinkMode((mode >> 8) & 0xFF);
sprintf(cmd, "uartmode %d", mode & 0xFF);
system(cmd);
SetUARTMode(mode);
}
static int joyswap = 0;