comparison Small_CPU/Inc/uart.h @ 704:f1b40364b0af

Added protocol functions for UART DiveO2 sensor: The code has been modified to support the handling of several protocols (including baud rate changes). The data is requested by polling and passed via DMA into a ringbuffer which is then parsed by a cyclic function call in the main loop. At the moment only the O2 values are forwarded but because the sensor send several types of data within a signle message already more is extracted but yet discarded.
author Ideenmodellierer
date Fri, 28 Oct 2022 20:49:21 +0200
parents fca2bd25e6e2
children 045ff7800501
comparison
equal deleted inserted replaced
703:2f457024049b 704:f1b40364b0af
44 RX_Data11, 44 RX_Data11,
45 RX_Data12, 45 RX_Data12,
46 RX_DataComplete 46 RX_DataComplete
47 } receiveState_t; 47 } receiveState_t;
48 48
49 typedef enum
50 {
51 UART_O2_INIT = 0,
52 UART_O2_CHECK, /* send blink command and check if sensor answers */
53 UART_O2_REQ_INFO, /* request information about available internal sensors of sensor */
54 UART_O2_REQ_ID, /* request ID of sensor */
55 UART_O2_IDLE, /* sensor detected and no communication pending */
56 UART_O2_REQ_O2, /* O2 value has been requested and is in receiption progress */
57 UART_O2_ERROR /* Error state which could not be resolved => only exit via de-/activation cycle */
58 } uartO2Status_t;
59
60
61 typedef enum
62 {
63 O2RX_IDLE = 0, /* no receiption pending */
64 O2RX_CONFIRM, /* check the command echo */
65 O2RX_GETNR, /* extract the sensor number */
66 O2RX_GETO2, /* extract the ppo2 */
67 O2RX_GETTEMP, /* extract the temperature */
68 O2RX_GETSTATUS, /* extract the sensor status */
69 O2RX_GETTYPE, /* extract the sensor type (should be 8) */
70 O2RX_GETCHANNEL, /* extract the number of sensor channels (should be 1) */
71 O2RX_GETVERSION, /* extract the sensor version */
72 O2RX_GETSUBSENSORS /* extract the available measures (O2, temperature, humidity etc) */
73 } uartO2RxState_t;
49 74
50 void MX_USART1_UART_Init(void); 75 void MX_USART1_UART_Init(void);
51 void MX_USART1_UART_DeInit(void); 76 void MX_USART1_UART_DeInit(void);
52 void MX_USART1_DMA_Init(void); 77 void MX_USART1_DMA_Init(void);
53 uint8_t UART_ButtonAdjust(uint8_t *array); 78 uint8_t UART_ButtonAdjust(uint8_t *array);
55 void HandleUARTCO2Data(void); 80 void HandleUARTCO2Data(void);
56 #endif 81 #endif
57 #ifdef ENABLE_SENTINEL_MODE 82 #ifdef ENABLE_SENTINEL_MODE
58 void HandleUARTSentinelData(void); 83 void HandleUARTSentinelData(void);
59 #endif 84 #endif
85 void HandleUARTDigitalO2(void);
86
60 #ifdef __cplusplus 87 #ifdef __cplusplus
61 } 88 }
62 #endif 89 #endif
63 90
64 #endif /* UART_H */ 91 #endif /* UART_H */