comparison Small_CPU/Src/uart.c @ 988:d9290c76b840 GasConsumption

OSTC4/5 joined code: In the previous version code differences between OSTC4/5 were identified using the ENABLE_GPIO_V2 compiler switch. In the new version this is done using the display version as indicator which OSTC model is in used. Since this is detected by Firmware the information is forwarded from there to the RTE. This causes a little delay in the GPIO initialization but this applies only to the cold start of the RTE which should not happen very often.
author ideenmodellierer
date Sun, 06 Apr 2025 21:02:17 +0200 (4 weeks ago)
parents 0b81ac558e89
children c386ae6635e4
comparison
equal deleted inserted replaced
984:41136649b90d 988:d9290c76b840
26 #include "uartProtocol_GNSS.h" 26 #include "uartProtocol_GNSS.h"
27 #include "externalInterface.h" 27 #include "externalInterface.h"
28 #include "data_exchange.h" 28 #include "data_exchange.h"
29 #include <string.h> /* memset */ 29 #include <string.h> /* memset */
30 30
31 #ifdef ENABLE_GPIO_V2 31 #ifdef ENABLE_GNSS_INTERN
32 extern UART_HandleTypeDef huart6; 32 extern UART_HandleTypeDef huart6;
33 extern sUartComCtrl Uart6Ctrl; 33 extern sUartComCtrl Uart6Ctrl;
34 #endif 34 #endif
35 35
36 /* Private variables ---------------------------------------------------------*/ 36 /* Private variables ---------------------------------------------------------*/
102 Uart1Ctrl.dmaTxActive = 0; 102 Uart1Ctrl.dmaTxActive = 0;
103 Uart1Ctrl.pRxBuffer = rxBuffer; 103 Uart1Ctrl.pRxBuffer = rxBuffer;
104 Uart1Ctrl.pTxBuffer = txBuffer; 104 Uart1Ctrl.pTxBuffer = txBuffer;
105 Uart1Ctrl.txBufferQueLen = 0; 105 Uart1Ctrl.txBufferQueLen = 0;
106 106
107 #ifndef ENABLE_GPIO_V2 107 #ifndef ENABLE_GNSS_INTERN
108 #ifdef ENABLE_GNSS_EXTERN
108 UART_SetGnssCtrl(&Uart1Ctrl); 109 UART_SetGnssCtrl(&Uart1Ctrl);
110 #endif
109 #endif 111 #endif
110 } 112 }
111 113
112 114
113 115
335 { 337 {
336 if(huart == &huart1) 338 if(huart == &huart1)
337 { 339 {
338 UART_HandleRxComplete(&Uart1Ctrl); 340 UART_HandleRxComplete(&Uart1Ctrl);
339 } 341 }
340 #ifdef ENABLE_GPIO_V2 342 #ifdef ENABLE_GNSS_INTERN
341 if(huart == &huart6) 343 if(GPIO_GetVersion() > 0)
342 { 344 {
343 UART_HandleRxComplete(&Uart6Ctrl); 345 if(huart == &huart6)
346 {
347 UART_HandleRxComplete(&Uart6Ctrl);
348 }
344 } 349 }
345 #endif 350 #endif
346 } 351 }
347 352
348 void UART_HandleTxComplete(sUartComCtrl* pUartCtrl) 353 void UART_HandleTxComplete(sUartComCtrl* pUartCtrl)
361 { 366 {
362 if(huart == &huart1) 367 if(huart == &huart1)
363 { 368 {
364 UART_HandleTxComplete(&Uart1Ctrl); 369 UART_HandleTxComplete(&Uart1Ctrl);
365 } 370 }
366 #ifdef ENABLE_GPIO_V2 371 #ifdef ENABLE_GNSS_INTERN
367 if(huart == &huart6) 372 if(GPIO_GetVersion() > 0)
368 { 373 {
369 UART_HandleTxComplete(&Uart6Ctrl); 374 if(huart == &huart6)
375 {
376 UART_HandleTxComplete(&Uart6Ctrl);
377 }
370 } 378 }
371 #endif 379 #endif
372 } 380 }
373 381
374 uint8_t UART_isEndIndication(sUartComCtrl* pCtrl, uint8_t index) 382 uint8_t UART_isEndIndication(sUartComCtrl* pCtrl, uint8_t index)
399 407
400 sUartComCtrl* pUartCtrl; 408 sUartComCtrl* pUartCtrl;
401 409
402 if(sensorType == SENSOR_GNSS) 410 if(sensorType == SENSOR_GNSS)
403 { 411 {
404 #ifdef ENABLE_GPIO_V2 412 #ifdef ENABLE_GNSS_INTERN
405 pUartCtrl = &Uart6Ctrl; 413 pUartCtrl = &Uart6Ctrl;
406 #else 414 #else
415 #ifdef ENABLE_GNSS_EXTERN
407 pUartCtrl = &Uart1Ctrl; 416 pUartCtrl = &Uart1Ctrl;
417 #endif
408 #endif 418 #endif
409 } 419 }
410 else 420 else
411 { 421 {
412 pUartCtrl = &Uart1Ctrl; 422 pUartCtrl = &Uart1Ctrl;
436 break; 446 break;
437 #ifdef ENABLE_CO2_SUPPORT 447 #ifdef ENABLE_CO2_SUPPORT
438 case SENSOR_CO2: uartCo2_ProcessData(pUartCtrl->pRxBuffer[localRX]); 448 case SENSOR_CO2: uartCo2_ProcessData(pUartCtrl->pRxBuffer[localRX]);
439 break; 449 break;
440 #endif 450 #endif
441 #if defined ENABLE_GNSS_SUPPORT || defined ENABLE_GPIO_V2 451 #if defined ENABLE_GNSS_INTERN || defined ENABLE_GNSS_EXTERN
442 case SENSOR_GNSS: uartGnss_ProcessData(pUartCtrl->pRxBuffer[localRX]); 452 case SENSOR_GNSS: uartGnss_ProcessData(pUartCtrl->pRxBuffer[localRX]);
443 break; 453 break;
444 #endif 454 #endif
445 #ifdef ENABLE_SENTINEL_MODE 455 #ifdef ENABLE_SENTINEL_MODE
446 case SENSOR_SENTINEL: uartSentinel_ProcessData(pUartCtrl->pRxBuffer[localRX]); 456 case SENSOR_SENTINEL: uartSentinel_ProcessData(pUartCtrl->pRxBuffer[localRX]);