uart: introduce TS_SECONDARY_SERIAL_PORT (#245)

(cherry picked from commit 9d8bbe38d1e63384ef0d66d3330363c894f2901b)

Co-authored-by: Andrey Gusakov <dron0gus@gmail.com>
This commit is contained in:
rusefillc 2023-05-03 14:46:13 -04:00 committed by GitHub
parent c7a8365ea3
commit 67f4aa45fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 0 deletions

View File

@ -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
}