comparison Small_CPU/Inc/uart.h @ 981:c6c781a2e85b default

Merge into default
author heinrichsweikamp
date Tue, 11 Feb 2025 18:12:00 +0100
parents 0b81ac558e89
children d9290c76b840
comparison
equal deleted inserted replaced
871:f7318457df4d 981:c6c781a2e85b
23 #endif 23 #endif
24 24
25 #include "stm32f4xx_hal.h" 25 #include "stm32f4xx_hal.h"
26 26
27 27
28 #define BUFFER_NODATA (7u) /* The read function needs a byte which indicated that no data for processing is available.*/ 28 #define BUFFER_NODATA_LOW (0x15) /* The read function needs a signiture which indicates that no data for processing is available.*/
29 /* This byte shall never appear in a normal data steam */ 29 #define BUFFER_NODATA_HIGH (0xA5)
30
31 #define TX_BUF_SIZE (80u) /* max length for commands */
32 #define CHUNK_SIZE (80u) /* the DMA will handle chunk size transfers */
33 #define CHUNKS_PER_BUFFER (3u)
34
35 typedef struct
36 {
37 UART_HandleTypeDef* pHandle; /* Pointer to UART handle structure */
38
39 uint8_t* pRxBuffer; /* Pointer to receive buffer */
40 uint8_t* pTxBuffer; /* Pointer to transmit buffer */
41 uint8_t* pTxQue; /* Pointer to transmit que */
42 uint8_t rxWriteIndex ; /* Index of the data item which is analyzed */
43 uint8_t rxReadIndex; /* Index at which new data is stared */
44 uint8_t txBufferQueLen; /* Length of qued data waiting for transmission */
45
46 uint8_t dmaRxActive; /* Indicator if DMA reception needs to be started */
47 uint8_t dmaTxActive; /* Indicator if DMA reception needs to be started */
48
49 } sUartComCtrl;
50
51 extern sUartComCtrl Uart1Ctrl;
52
53 UART_HandleTypeDef huart1;
30 54
31 void MX_USART1_UART_Init(void); 55 void MX_USART1_UART_Init(void);
32 void MX_USART1_UART_DeInit(void); 56 void MX_USART1_UART_DeInit(void);
33 void MX_USART1_DMA_Init(void); 57 void MX_USART1_DMA_Init(void);
58
59 void MX_USART6_UART_Init(void);
60 void MX_USART6_DMA_Init(void);
61 void MX_USART6_UART_DeInit(void);
62 void GNSS_IO_init(void);
63
34 uint8_t UART_ButtonAdjust(uint8_t *array); 64 uint8_t UART_ButtonAdjust(uint8_t *array);
35 void UART_StartDMA_Receiption(void); 65 void UART_StartDMA_Receiption(sUartComCtrl* pUartCtrl);
36 #ifdef ENABLE_CO2_SUPPORT 66 #ifdef ENABLE_CO2_SUPPORT
37 void UART_HandleCO2Data(void); 67 void UART_HandleCO2Data(void);
38 void DigitalCO2_SendCmd(uint8_t CO2Cmd, uint8_t *cmdString, uint8_t *cmdLength); 68 void DigitalCO2_SendCmd(uint8_t CO2Cmd, uint8_t *cmdString, uint8_t *cmdLength);
39 #endif 69 #endif
70
71 #ifdef ENABLE_GNSS_SUPPORT
72 void UART_HandleGnssData(void);
73 #endif
40 #ifdef ENABLE_SENTINEL_MODE 74 #ifdef ENABLE_SENTINEL_MODE
41 void UART_HandleSentinelData(void); 75 void UART_HandleSentinelData(void);
42 #endif 76 #endif
77 void UART_SetGnssCtrl(sUartComCtrl* pTarget);
78 sUartComCtrl* UART_GetGnssCtrl();
79 void UART_clearRxBuffer(sUartComCtrl* pUartCtrl);
43 uint8_t UART_isCO2Connected(); 80 uint8_t UART_isCO2Connected();
44 uint8_t UART_isSentinelConnected(); 81 uint8_t UART_isSentinelConnected();
45 void UART_setTargetChannel(uint8_t channel); 82 void UART_setTargetChannel(uint8_t channel);
46 void UART_MUX_SelectAddress(uint8_t muxAddress); 83 void UART_MUX_SelectAddress(uint8_t muxAddress);
47 void UART_SendCmdString(uint8_t *cmdString); 84 void UART_SendCmdString(uint8_t *cmdString);
48 void UART_ReadData(uint8_t sensorType); 85 void UART_SendCmdUbx(const uint8_t *cmd, uint8_t len);
49 void UART_FlushRxBuffer(void); 86 void UART_ReadData(uint8_t sensorType, uint8_t flush);
87 void UART_WriteData(sUartComCtrl* pUartCtrl);
50 void UART_ChangeBaudrate(uint32_t newBaudrate); 88 void UART_ChangeBaudrate(uint32_t newBaudrate);
89 uint8_t UART_isComActive(uint8_t sensorId);
90 uint8_t UART_isEndIndication(sUartComCtrl* pCtrl, uint8_t index);
51 91
52 void StringToInt(char *pstr, uint32_t *puInt32); 92 void StringToInt(char *pstr, uint32_t *puInt32);
53 void StringToUInt64(char *pstr, uint64_t *puint64); 93 void StringToUInt64(char *pstr, uint64_t *puint64);
54 94
55 #ifdef __cplusplus 95 #ifdef __cplusplus