Mercurial > public > ostc4
diff Small_CPU/Src/uart.c @ 1077:bd8ab302ef4a Icon_Integration
Added uart support for HUD:
the protocol implementation for the HUD has been added. It may be activated by the compile switch ENABLE_HUD_SUPPORT. Because the HUD will not mapped to the three classic o2 value display slots, the sensor data structure has been increased to the max number of devices => all devices may now raise device specific data.
| author | Ideenmodellierer |
|---|---|
| date | Mon, 02 Mar 2026 17:22:25 +0100 |
| parents | 1f2067cad41b |
| children |
line wrap: on
line diff
--- a/Small_CPU/Src/uart.c Sun Feb 22 21:23:57 2026 +0100 +++ b/Small_CPU/Src/uart.c Mon Mar 02 17:22:25 2026 +0100 @@ -24,6 +24,7 @@ #include "uartProtocol_Co2.h" #include "uartProtocol_Sentinel.h" #include "uartProtocol_GNSS.h" +#include "uartProtocol_HUD.h" #include "externalInterface.h" #include "data_exchange.h" #include "gpio.h" @@ -199,11 +200,8 @@ } } - -void UART_SendCmdString(uint8_t *cmdString) +void UART_SendCmdRaw(const uint8_t *cmd, uint8_t cmdLength) { - uint8_t cmdLength = strlen((char*)cmdString); - if(Uart1Ctrl.dmaTxActive == 0) { if(cmdLength < TX_BUF_SIZE) /* A longer string is an indication for a missing 0 termination */ @@ -212,7 +210,7 @@ { UART_StartDMA_Receiption(&Uart1Ctrl); } - memcpy(txBuffer, cmdString, cmdLength); + memcpy(txBuffer, cmd, cmdLength); if(HAL_OK == HAL_UART_Transmit_DMA(&huart1,txBuffer,cmdLength)) { Uart1Ctrl.dmaTxActive = 1; @@ -222,11 +220,18 @@ } else { - memcpy(txBufferQue, cmdString, cmdLength); + memcpy(txBufferQue, cmd, cmdLength); Uart1Ctrl.txBufferQueLen = cmdLength; } } +void UART_SendCmdString(uint8_t *cmdString) +{ + uint8_t cmdLength = strlen((char*)cmdString); + + UART_SendCmdRaw(cmdString, cmdLength); +} + void UART_AddFletcher(uint8_t* pBuffer, uint8_t length) { uint8_t ck_A = 0; @@ -459,6 +464,10 @@ case SENSOR_SENTINEL: uartSentinel_ProcessData(pUartCtrl->pRxBuffer[localRX]); break; #endif +#ifdef ENABLE_HUD_SUPPORT + case SENSOR_HUD: uartHUD_ProcessData(pUartCtrl->pRxBuffer[localRX]); + break; +#endif default: break; }
