mirror of https://github.com/rusefi/wideband.git
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:
parent
5c06f03439
commit
4ca946b91a
|
@ -13,11 +13,10 @@
|
||||||
#include "tunerstudio_io.h"
|
#include "tunerstudio_io.h"
|
||||||
#include "wideband_board_config.h"
|
#include "wideband_board_config.h"
|
||||||
|
|
||||||
#ifdef UART_DEBUG
|
#ifdef DEBUG_SERIAL_PORT
|
||||||
// just a reminder that we have either TS connectivity or this UART_DEBUG but not both
|
|
||||||
|
|
||||||
SerialConfig cfg = {
|
SerialConfig cfg = {
|
||||||
.speed = 115200,
|
.speed = DEBUG_SERIAL_BAUDRATE,
|
||||||
.cr1 = 0,
|
.cr1 = 0,
|
||||||
.cr2 = USART_CR2_STOP1_BITS | USART_CR2_LINEN,
|
.cr2 = USART_CR2_STOP1_BITS | USART_CR2_LINEN,
|
||||||
.cr3 = 0
|
.cr3 = 0
|
||||||
|
@ -30,7 +29,6 @@ static void UartThread(void*)
|
||||||
{
|
{
|
||||||
chRegSetThreadName("UART debug");
|
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);
|
sdStart(&SD1, &cfg);
|
||||||
|
|
||||||
while(true)
|
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
|
#ifdef TS_PRIMARY_UART_PORT
|
||||||
static UartTsChannel primaryChannel(TS_PRIMARY_UART_PORT);
|
static UartTsChannel primaryChannel(TS_PRIMARY_UART_PORT);
|
||||||
|
@ -95,13 +95,14 @@ struct PrimaryChannelThread : public TunerstudioThread {
|
||||||
|
|
||||||
static PrimaryChannelThread primaryChannelThread;
|
static PrimaryChannelThread primaryChannelThread;
|
||||||
|
|
||||||
#endif
|
#endif /* TS_ENABLED */
|
||||||
|
|
||||||
void InitUart()
|
void InitUart()
|
||||||
{
|
{
|
||||||
#ifdef UART_DEBUG
|
#ifdef DEBUG_SERIAL_PORT
|
||||||
chThdCreateStatic(waUartThread, sizeof(waUartThread), NORMALPRIO, UartThread, nullptr);
|
chThdCreateStatic(waUartThread, sizeof(waUartThread), NORMALPRIO, UartThread, nullptr);
|
||||||
#elif defined(TS_ENABLED)
|
#endif
|
||||||
|
#ifdef TS_ENABLED
|
||||||
primaryChannelThread.Start();
|
primaryChannelThread.Start();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue