annotate Small_CPU/Inc/uart.h @ 941:6d8ae8fbccf5 Evo_2_23

Added gnss to logbook data: The gnss position is now available in the logbook. It is stored as event (7:2) at the start of the dive. The position will be shown in the logbook page 1 in the top middle position.
author Ideenmodellierer
date Mon, 16 Dec 2024 19:06:37 +0100
parents 3029f0332f4f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file uart.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 27-March-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief button control
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 * <h2><center>&copy; COPYRIGHT(c) 2015 heinrichs weikamp</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 #ifndef UART_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 #define UART_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 extern "C" {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
27
918
f72613a152dd Switch external interface tx communication to DMA:
Ideenmodellierer
parents: 916
diff changeset
28 #define BUFFER_NODATA_LOW (0x15) /* The read function needs a signiture which indicates that no data for processing is available.*/
916
4832981f9af8 External sensor UART: Switch to DMA TX transfers:
Ideenmodellierer
parents: 890
diff changeset
29 #define BUFFER_NODATA_HIGH (0xA5)
794
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
30
936
3029f0332f4f GNSS introduced power saving mode:
Ideenmodellierer
parents: 932
diff changeset
31 #define TX_BUF_SIZE (80u) /* max length for commands */
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
32 #define CHUNK_SIZE (80u) /* the DMA will handle chunk size transfers */
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
33 #define CHUNKS_PER_BUFFER (3u)
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
34
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
35 typedef struct
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
36 {
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
37 UART_HandleTypeDef* pHandle; /* Pointer to UART handle structure */
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
38
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
39 uint8_t* pRxBuffer; /* Pointer to receive buffer */
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
40 uint8_t* pTxBuffer; /* Pointer to transmit buffer */
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
41 uint8_t* pTxQue; /* Pointer to transmit que */
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
42 uint8_t rxWriteIndex ; /* Index of the data item which is analyzed */
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
43 uint8_t rxReadIndex; /* Index at which new data is stared */
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
44 uint8_t txBufferQueLen; /* Length of qued data waiting for transmission */
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
45
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
46 uint8_t dmaRxActive; /* Indicator if DMA reception needs to be started */
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
47 uint8_t dmaTxActive; /* Indicator if DMA reception needs to be started */
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
48
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
49 } sUartComCtrl;
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
50
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
51 extern sUartComCtrl Uart1Ctrl;
889
cf3967fe6924 GNSS work in progress
heinrichsweikamp
parents: 861
diff changeset
52
922
7c996354b8ac Moved UART6 into a separate unit:
Ideenmodellierer
parents: 918
diff changeset
53 UART_HandleTypeDef huart1;
889
cf3967fe6924 GNSS work in progress
heinrichsweikamp
parents: 861
diff changeset
54
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
55 void MX_USART1_UART_Init(void);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
56 void MX_USART1_UART_DeInit(void);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
57 void MX_USART1_DMA_Init(void);
889
cf3967fe6924 GNSS work in progress
heinrichsweikamp
parents: 861
diff changeset
58
cf3967fe6924 GNSS work in progress
heinrichsweikamp
parents: 861
diff changeset
59 void MX_USART6_UART_Init(void);
cf3967fe6924 GNSS work in progress
heinrichsweikamp
parents: 861
diff changeset
60 void MX_USART6_DMA_Init(void);
890
651d21777b61 cleanup and disable function for GNSS uart and DMA
heinrichsweikamp
parents: 889
diff changeset
61 void MX_USART6_UART_DeInit(void);
889
cf3967fe6924 GNSS work in progress
heinrichsweikamp
parents: 861
diff changeset
62 void GNSS_IO_init(void);
cf3967fe6924 GNSS work in progress
heinrichsweikamp
parents: 861
diff changeset
63
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 uint8_t UART_ButtonAdjust(uint8_t *array);
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
65 void UART_StartDMA_Receiption(sUartComCtrl* pUartCtrl);
690
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
66 #ifdef ENABLE_CO2_SUPPORT
729
d646a0f724a7 Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents: 721
diff changeset
67 void UART_HandleCO2Data(void);
794
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
68 void DigitalCO2_SendCmd(uint8_t CO2Cmd, uint8_t *cmdString, uint8_t *cmdLength);
690
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
69 #endif
916
4832981f9af8 External sensor UART: Switch to DMA TX transfers:
Ideenmodellierer
parents: 890
diff changeset
70
4832981f9af8 External sensor UART: Switch to DMA TX transfers:
Ideenmodellierer
parents: 890
diff changeset
71 #ifdef ENABLE_GNSS_SUPPORT
4832981f9af8 External sensor UART: Switch to DMA TX transfers:
Ideenmodellierer
parents: 890
diff changeset
72 void UART_HandleGnssData(void);
4832981f9af8 External sensor UART: Switch to DMA TX transfers:
Ideenmodellierer
parents: 890
diff changeset
73 #endif
690
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
74 #ifdef ENABLE_SENTINEL_MODE
729
d646a0f724a7 Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents: 721
diff changeset
75 void UART_HandleSentinelData(void);
690
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
76 #endif
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
77 void UART_SetGnssCtrl(sUartComCtrl* pTarget);
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
78 sUartComCtrl* UART_GetGnssCtrl();
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
79 void UART_clearRxBuffer(sUartComCtrl* pUartCtrl);
729
d646a0f724a7 Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents: 721
diff changeset
80 uint8_t UART_isCO2Connected();
742
e23fe82cbf8c Update Sentinel protocol:
Ideenmodellierer
parents: 729
diff changeset
81 uint8_t UART_isSentinelConnected();
729
d646a0f724a7 Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents: 721
diff changeset
82 void UART_setTargetChannel(uint8_t channel);
794
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
83 void UART_MUX_SelectAddress(uint8_t muxAddress);
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
84 void UART_SendCmdString(uint8_t *cmdString);
922
7c996354b8ac Moved UART6 into a separate unit:
Ideenmodellierer
parents: 918
diff changeset
85 void UART_SendCmdUbx(const uint8_t *cmd, uint8_t len);
794
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
86 void UART_ReadData(uint8_t sensorType);
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
87 void UART_WriteData(sUartComCtrl* pUartCtrl);
794
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
88 void UART_FlushRxBuffer(void);
798
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents: 794
diff changeset
89 void UART_ChangeBaudrate(uint32_t newBaudrate);
861
ad96f99ebc78 Synchronize ADC and UART activities:
Ideenmodellierer
parents: 798
diff changeset
90 uint8_t UART_isComActive(uint8_t sensorId);
932
effadaa3a1f7 Cleanup Gnss UART implementation:
Ideenmodellierer
parents: 922
diff changeset
91 uint8_t UART_isEndIndication(sUartComCtrl* pCtrl, uint8_t index);
729
d646a0f724a7 Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents: 721
diff changeset
92
794
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
93 void StringToInt(char *pstr, uint32_t *puInt32);
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
94 void StringToUInt64(char *pstr, uint64_t *puint64);
704
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
95
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 #endif /* UART_H */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/