Refactoring: less confusion macro names around serial/uart/etc in connectivity #4999

This commit is contained in:
rusefillc 2023-01-23 05:09:32 -05:00
parent b2eccd26ca
commit 083bafb3ba
13 changed files with 22 additions and 22 deletions

View File

@ -7,7 +7,7 @@
#include "dfu.h"
// Communication vars
static UartTsChannel blTsChannel(TS_PRIMARY_PORT);
static UartTsChannel blTsChannel(TS_PRIMARY_UxART_PORT);
static uint8_t buffer[DFU_BUFFER_SIZE];
// Use short timeout for the first data packet, and normal timeout for the rest
static int sr5Timeout = DFU_SR5_TIMEOUT_FIRST;

View File

@ -271,7 +271,7 @@
#define TS_CAN_AF PAL_MODE_ALTERNATIVE_CAN
#define TS_CAN_DEVICE_SHORT_PACKETS_IN_ONE_FRAME
#undef TS_PRIMARY_PORT
#undef TS_PRIMARY_UxART_PORT
#undef TS_SECONDARY_PORT
#define EFI_USB_SERIAL TRUE

View File

@ -6,6 +6,6 @@ endif
DDEFS += $(LED_CRITICAL_ERROR_BRAIN_PIN)
PRIMARY_COMMUNICATION_PORT_USART2=-DEFI_CONSOLE_TX_BRAIN_PIN=Gpio::D6 -DEFI_CONSOLE_RX_BRAIN_PIN=Gpio::D5 -DTS_PRIMARY_PORT=UARTD2 -DSTM32_UART_USE_USART2=1
PRIMARY_COMMUNICATION_PORT_USART2=-DEFI_CONSOLE_TX_BRAIN_PIN=Gpio::D6 -DEFI_CONSOLE_RX_BRAIN_PIN=Gpio::D5 -DTS_PRIMARY_UxART_PORT=UARTD2 -DSTM32_UART_USE_USART2=1
include $(BOARDS_DIR)/hellen/hellen-common.mk

View File

@ -259,7 +259,7 @@
*/
#define EFI_USE_UART_DMA FALSE
#define TS_PRIMARY_PORT UARTD2
#define TS_PRIMARY_UxART_PORT UARTD2
#undef TS_SECONDARY_PORT
#define EFI_CONSOLE_TX_BRAIN_PIN Gpio::A10
@ -351,6 +351,6 @@
if (__debugEnabled) { \
extern char __debugBuffer[80]; \
chsnprintf(__debugBuffer, sizeof(__debugBuffer), fmt, ##__VA_ARGS__); \
uart_lld_blocking_send(TS_PRIMARY_PORT, strlen(__debugBuffer), (void *)__debugBuffer); \
uart_lld_blocking_send(TS_PRIMARY_UxART_PORT, strlen(__debugBuffer), (void *)__debugBuffer); \
} \
}

View File

@ -34,8 +34,8 @@
#define ADC_CHANNEL_VREF ADC_CHANNEL_IN14
#undef TS_PRIMARY_PORT
#define TS_PRIMARY_PORT UARTD4
#undef TS_PRIMARY_UxART_PORT
#define TS_PRIMARY_UxART_PORT UARTD4
#undef EFI_UART_GPS
#define EFI_UART_GPS FALSE

View File

@ -31,7 +31,7 @@ endif
ifeq ($(PROJECT_CPU),ARCH_STM32F4)
# Hardware serial port on UART 2 -> PD5/PD6
DDEFS += -DSTM32_UART_USE_USART2=TRUE
DDEFS += -DTS_PRIMARY_PORT=UARTD2
DDEFS += -DTS_PRIMARY_UxART_PORT=UARTD2
DDEFS += -DEFI_CONSOLE_TX_BRAIN_PIN=Gpio::D5 -DEFI_CONSOLE_RX_BRAIN_PIN=Gpio::D6
endif

View File

@ -21,8 +21,8 @@
#define LED_RUNING_BRAIN_PIN_MODE INVERTED_OUTPUT
/* debug console */
#undef TS_PRIMARY_PORT
#define TS_PRIMARY_PORT SD1
#undef TS_PRIMARY_UxART_PORT
#define TS_PRIMARY_UxART_PORT SD1
// no secondary channel
#undef TS_SECONDARY_PORT
@ -92,7 +92,7 @@
#undef SERIAL_SPEED
#define SERIAL_SPEED 115200
#ifdef TS_PRIMARY_PORT
#ifdef TS_PRIMARY_UxART_PORT
#undef EFI_CONSOLE_TX_PORT
#define EFI_CONSOLE_TX_PORT GPIOA
#undef EFI_CONSOLE_TX_PIN

View File

@ -394,8 +394,8 @@
#define EFI_USE_UART_DMA TRUE
#endif
#ifndef TS_PRIMARY_PORT
#define TS_PRIMARY_PORT UARTD3
#ifndef TS_PRIMARY_UxART_PORT
#define TS_PRIMARY_UxART_PORT UARTD3
#endif
#undef TS_SECONDARY_PORT

View File

@ -10,7 +10,7 @@
#include "global.h"
#include "tunerstudio_impl.h"
#if (!TS_NO_PRIMARY && defined(TS_PRIMARY_PORT))
#if (!TS_NO_PRIMARY && defined(TS_PRIMARY_UxART_PORT))
#define HAS_UxART_PRIMARY true
#else
#define HAS_UxART_PRIMARY false

View File

@ -21,7 +21,7 @@ class UartTsChannel;
class SerialTsChannel;
#if HAS_UxART_PRIMARY
#ifdef TS_PRIMARY_PORT
#ifdef TS_PRIMARY_UxART_PORT
// We want to instantiate the correct channel type depending on what type of serial port we're
// using. ChibiOS supports two - UART and Serial. We compare the type of the port we're given
@ -29,14 +29,14 @@ class SerialTsChannel;
// UART is further subdivided into two depending whether we support DMA or not. We use the right
// combination of std::conditional, std::is_same, and #if to get what we want.
std::conditional_t<
std::is_same_v<decltype(TS_PRIMARY_PORT), UARTDriver>,
std::is_same_v<decltype(TS_PRIMARY_UxART_PORT), UARTDriver>,
#if EFI_USE_UART_DMA
UartDmaTsChannel,
#else // EFI_USE_UART_DMA
UartTsChannel,
#endif // EFI_USE_UART_DMA
SerialTsChannel> primaryChannel(TS_PRIMARY_PORT);
#endif // TS_PRIMARY_PORT
SerialTsChannel> primaryChannel(TS_PRIMARY_UxART_PORT);
#endif // TS_PRIMARY_UxART_PORT
struct PrimaryChannelThread : public TunerstudioThread {
PrimaryChannelThread() : TunerstudioThread("Primary TS Channel") { }

View File

@ -116,7 +116,7 @@
*/
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
/* Configured in efifeatures.h */
#if defined(TS_PRIMARY_PORT)
#if defined(TS_PRIMARY_UxART_PORT)
#define HAL_USE_UART TRUE
#else
#define HAL_USE_UART FALSE

View File

@ -121,7 +121,7 @@
*/
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
/* Configured in efifeatures.h */
#if defined(TS_PRIMARY_PORT)
#if defined(TS_PRIMARY_UxART_PORT)
#define HAL_USE_UART TRUE
#else
#define HAL_USE_UART FALSE
@ -200,7 +200,7 @@
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
/* Configured in efifeatures.h */
#if defined(TS_PRIMARY_PORT)
#if defined(TS_PRIMARY_UxART_PORT)
#define UART_USE_WAIT TRUE
#else
#define UART_USE_WAIT FALSE

View File

@ -8,7 +8,7 @@
#pragma once
// see SIM_SD1_PORT and SIM_SD2_PORT
#define TS_PRIMARY_PORT SD1
#define TS_PRIMARY_UxART_PORT SD1
#define TS_SECONDARY_PORT SD2
#define EFI_ENABLE_ASSERTS TRUE