Mercurial > public > ostc4
annotate Small_CPU/Inc/uart.h @ 939:f41974734268 Evo_2_23 tip
Resume UART com with gnss after sleep:
Some changes were needed to get the communication up and running again after the gnns modul was set into power mode. The config needs to be safed at shutdown and the receiver needs to be wake up using dummy bytes before real communication may be resumed
author | Ideenmodellierer |
---|---|
date | Tue, 10 Dec 2024 21:03:04 +0100 |
parents | 3029f0332f4f |
children |
rev | line source |
---|---|
38 | 1 /** |
2 ****************************************************************************** | |
3 * @file uart.h | |
4 * @author heinrichs weikamp gmbh | |
5 * @version V0.0.1 | |
6 * @date 27-March-2014 | |
7 * @brief button control | |
8 * | |
9 ****************************************************************************** | |
10 * @attention | |
11 * | |
12 * <h2><center>© COPYRIGHT(c) 2015 heinrichs weikamp</center></h2> | |
13 * | |
14 ****************************************************************************** | |
15 */ | |
16 | |
17 /* Define to prevent recursive inclusion -------------------------------------*/ | |
18 #ifndef UART_H | |
19 #define UART_H | |
20 | |
21 #ifdef __cplusplus | |
22 extern "C" { | |
23 #endif | |
24 | |
25 #include "stm32f4xx_hal.h" | |
26 | |
662 | 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 | 30 |
936 | 31 #define TX_BUF_SIZE (80u) /* max length for commands */ |
932 | 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; | |
889 | 52 |
922 | 53 UART_HandleTypeDef huart1; |
889 | 54 |
662 | 55 void MX_USART1_UART_Init(void); |
56 void MX_USART1_UART_DeInit(void); | |
57 void MX_USART1_DMA_Init(void); | |
889 | 58 |
59 void MX_USART6_UART_Init(void); | |
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 | 62 void GNSS_IO_init(void); |
63 | |
38 | 64 uint8_t UART_ButtonAdjust(uint8_t *array); |
932 | 65 void UART_StartDMA_Receiption(sUartComCtrl* pUartCtrl); |
690 | 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 | 68 void DigitalCO2_SendCmd(uint8_t CO2Cmd, uint8_t *cmdString, uint8_t *cmdLength); |
690 | 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 | 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 | 76 #endif |
932 | 77 void UART_SetGnssCtrl(sUartComCtrl* pTarget); |
78 sUartComCtrl* UART_GetGnssCtrl(); | |
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 | 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 | 83 void UART_MUX_SelectAddress(uint8_t muxAddress); |
84 void UART_SendCmdString(uint8_t *cmdString); | |
922 | 85 void UART_SendCmdUbx(const uint8_t *cmd, uint8_t len); |
794 | 86 void UART_ReadData(uint8_t sensorType); |
932 | 87 void UART_WriteData(sUartComCtrl* pUartCtrl); |
794 | 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 | 90 uint8_t UART_isComActive(uint8_t sensorId); |
932 | 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 | 93 void StringToInt(char *pstr, uint32_t *puInt32); |
94 void StringToUInt64(char *pstr, uint64_t *puint64); | |
704
f1b40364b0af
Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents:
690
diff
changeset
|
95 |
38 | 96 #ifdef __cplusplus |
97 } | |
98 #endif | |
99 | |
100 #endif /* UART_H */ | |
101 | |
102 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ |