comparison Small_CPU/Inc/uartProtocol_HUD.h @ 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
children
comparison
equal deleted inserted replaced
1076:c87753e73eb8 1077:bd8ab302ef4a
1 /**
2 ******************************************************************************
3 * @file uartProtocol_HUD.h
4 * @author heinrichs weikamp gmbh
5 * @version V0.0.1
6 * @date 24-Feb-2026
7 * @brief Interface functionality to handle external, UART based CO2 sensors
8 *
9 @verbatim
10 ==============================================================================
11 ##### How to use #####
12 ==============================================================================
13 @endverbatim
14 ******************************************************************************
15 * @attention
16 *
17 * <h2><center>&copy; COPYRIGHT(c) 2014 heinrichs weikamp</center></h2>
18 *
19 ******************************************************************************
20 */
21
22 /* Define to prevent recursive inclusion -------------------------------------*/
23 #ifndef UART_PROTOCOL_HUD_H
24 #define UART_PROTOCOL_HUD_H
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /* Includes ------------------------------------------------------------------*/
31 #include "configuration.h"
32 #include "stm32f4xx_hal.h"
33
34
35 #define HUD_INFO_DATA_LENGTH (24u) /* expected number of received info data */
36 #define HUD_MAX_CMD_LENGTH (32u) /* max length for a command sequence */
37
38 #define HUD_CMD_BYTE_START (0xAA) /* Start byte */
39 #define HUD_CMD_BYTE_INFO (0x10) /* Request HUD info */
40 #define HUD_CMD_BYTE_UPDATE (0x20) /* Update LED sequence command */
41 #define HUD_CMD_BYTE_STOP (0x30) /* Stip LED sequence execution */
42
43 typedef enum
44 {
45 UART_HUD_INIT = 0, /* Default Status for every sensor type */
46 UART_HUD_IDLE, /* sensor detected and no communication pending */
47 UART_HUD_ERROR,
48 UART_HUD_SETUP = 10, /* collecting data */
49 UART_HUD_UPDATE, /* update the HUD status LEDs */
50 UART_HUD_ABORT, /* abort status sequence */
51 } uartHUDStatus_t;
52
53 typedef enum
54 {
55 HUDRX_Ready= 0, /* Initial state */
56 HUDRX_DetectStart, /* validate start byte */
57 HUDRX_RXData,
58 HUDRX_CheckSum_L,
59 HUDRX_CheckSum_H,
60 HUDRX_DataComplete
61 } receiveStateHUD_t;
62
63
64 typedef enum
65 {
66 HUDCMD_GETINFO = 0, /* Get HUD info */
67 HUDCMD_UPDATE, /* Update LED sequence */
68 HUDCMD_ABORTSEQ /* Abort LED sequence */
69 } hudSensorCmd_t;
70
71
72 void uartHUD_Control(void);
73 void uartHUD_ProcessData(uint8_t data);
74 void uartHUD_SendCmd(uint8_t HUDCmd);
75 uint8_t uartHUD_isSensorConnected();
76
77 #endif /* UART_PROTOCOL_HUD_H */