From 67f4aa45fe01d33eb2e938dc8ee340174022afb8 Mon Sep 17 00:00:00 2001 From: rusefillc <48498823+rusefillc@users.noreply.github.com> Date: Wed, 3 May 2023 14:46:13 -0400 Subject: [PATCH] uart: introduce TS_SECONDARY_SERIAL_PORT (#245) (cherry picked from commit 9d8bbe38d1e63384ef0d66d3330363c894f2901b) Co-authored-by: Andrey Gusakov --- firmware/uart.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/firmware/uart.cpp b/firmware/uart.cpp index bb6f275..e2d9744 100644 --- a/firmware/uart.cpp +++ b/firmware/uart.cpp @@ -95,6 +95,22 @@ struct PrimaryChannelThread : public TunerstudioThread { static PrimaryChannelThread primaryChannelThread; +#ifdef TS_SECONDARY_SERIAL_PORT +static SerialTsChannel secondaryChannel(TS_SECONDARY_SERIAL_PORT); + +struct SecondaryChannelThread : public TunerstudioThread { + SecondaryChannelThread() : TunerstudioThread("Secondary TS Channel") { } + + TsChannelBase* setupChannel() { + secondaryChannel.start(TS_SECONDARY_BAUDRATE); + + return &secondaryChannel; + } +}; + +static SecondaryChannelThread secondaryChannelThread; + +#endif /* TS_SECONDARY_SERIAL_PORT */ #endif /* TS_ENABLED */ void InitUart() @@ -104,5 +120,8 @@ void InitUart() #endif #ifdef TS_ENABLED primaryChannelThread.Start(); +#ifdef TS_SECONDARY_SERIAL_PORT + secondaryChannelThread.Start(); +#endif #endif }