Integrate with TS interface

This commit is contained in:
Andrey Gusakov 2022-05-30 01:01:23 +03:00
parent 627e920e93
commit afa517e2d5
2 changed files with 39 additions and 0 deletions

View File

@ -9,6 +9,10 @@
#include "port.h" #include "port.h"
#include "io_pins.h" #include "io_pins.h"
#if 1 /* tunerstudio */
#include "livedata.h"
#endif
// Stored results // Stored results
static float nernstAcHi = 0; static float nernstAcHi = 0;
static float nernstAcLo = 0; static float nernstAcLo = 0;
@ -151,6 +155,10 @@ static void SamplingThread(void*)
} }
state = next_state; state = next_state;
/* tunerstudio */
#if 1
SamplingUpdateLiveData();
#endif
} }
} }

View File

@ -8,6 +8,12 @@
#include "fault.h" #include "fault.h"
#include "uart.h" #include "uart.h"
#include "tunerstudio.h"
#include "tunerstudio_io.h"
#include "wideband_board_config.h"
#if 0
static const UARTConfig uartCfg = static const UARTConfig uartCfg =
{ {
.txend1_cb = nullptr, .txend1_cb = nullptr,
@ -55,10 +61,35 @@ static void UartThread(void*)
chThdSleepMilliseconds(50); chThdSleepMilliseconds(50);
} }
} }
#endif
#ifdef TS_PRIMARY_UART_PORT
static UartTsChannel primaryChannel(TS_PRIMARY_UART_PORT);
#endif
#ifdef TS_PRIMARY_SERIAL_PORT
static SerialTsChannel primaryChannel(TS_PRIMARY_SERIAL_PORT);
#endif
struct PrimaryChannelThread : public TunerstudioThread {
PrimaryChannelThread() : TunerstudioThread("Primary TS Channel") { }
TsChannelBase* setupChannel() {
primaryChannel.start(TS_PRIMARY_BAUDRATE);
return &primaryChannel;
}
};
static PrimaryChannelThread primaryChannelThread;
void InitUart() void InitUart()
{ {
#if 0
uartStart(&UARTD1, &uartCfg); uartStart(&UARTD1, &uartCfg);
chThdCreateStatic(waUartThread, sizeof(waUartThread), NORMALPRIO, UartThread, nullptr); chThdCreateStatic(waUartThread, sizeof(waUartThread), NORMALPRIO, UartThread, nullptr);
#else
primaryChannelThread.Start();
#endif
} }