uart: rename UART_DEBUG to DEBUG_SERIAL_PORT (#236)

Also allow coexistance of DEBUG_SERIAL_PORT and TS_ENABLED

(cherry picked from commit 87cb7d1309cb8aac38f2e4e979252690df0cbb39)

Co-authored-by: Andrey Gusakov <dron0gus@gmail.com>
This commit is contained in:
rusefillc 2023-04-27 15:54:32 -04:00 committed by GitHub
parent 5c06f03439
commit 4ca946b91a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

@ -13,11 +13,10 @@
#include "tunerstudio_io.h"
#include "wideband_board_config.h"
#ifdef UART_DEBUG
// just a reminder that we have either TS connectivity or this UART_DEBUG but not both
#ifdef DEBUG_SERIAL_PORT
SerialConfig cfg = {
.speed = 115200,
.speed = DEBUG_SERIAL_BAUDRATE,
.cr1 = 0,
.cr2 = USART_CR2_STOP1_BITS | USART_CR2_LINEN,
.cr3 = 0
@ -30,7 +29,6 @@ static void UartThread(void*)
{
chRegSetThreadName("UART debug");
// in UART_DEBUG mode we only support Serial - this file name here has a bit of a confusing naming
sdStart(&SD1, &cfg);
while(true)
@ -73,7 +71,9 @@ static void UartThread(void*)
}
}
#elif defined(TS_ENABLED)
#endif /* DEBUG_SERIAL_PORT */
#ifdef TS_ENABLED
#ifdef TS_PRIMARY_UART_PORT
static UartTsChannel primaryChannel(TS_PRIMARY_UART_PORT);
@ -95,13 +95,14 @@ struct PrimaryChannelThread : public TunerstudioThread {
static PrimaryChannelThread primaryChannelThread;
#endif
#endif /* TS_ENABLED */
void InitUart()
{
#ifdef UART_DEBUG
#ifdef DEBUG_SERIAL_PORT
chThdCreateStatic(waUartThread, sizeof(waUartThread), NORMALPRIO, UartThread, nullptr);
#elif defined(TS_ENABLED)
#endif
#ifdef TS_ENABLED
primaryChannelThread.Start();
#endif
}