Mercurial > public > ostc4
diff Small_CPU/Inc/uart.h @ 798:e9eba334b942
Migrated CO2 protocol implementation to new format:
The previous implementation was a monolithic protocol implementation which was not usable together with the multiplexer. The new implementation moves the CO2 implementation into a separate C file and decoubles the upper layer external interface, which is not able to handle DiveO2 and CO2 sensors in parallel without restriction to port assignments.
author | Ideenmodellierer |
---|---|
date | Mon, 07 Aug 2023 20:29:44 +0200 |
parents | bb37d4f3e50e |
children | ad96f99ebc78 |
line wrap: on
line diff
--- a/Small_CPU/Inc/uart.h Mon Jul 31 20:10:27 2023 +0200 +++ b/Small_CPU/Inc/uart.h Mon Aug 07 20:29:44 2023 +0200 @@ -25,47 +25,9 @@ #include "stm32f4xx_hal.h" -#define BUFFER_NODATA (7u) /* The read function needs a byte which indecated that no data for processing is available.*/ +#define BUFFER_NODATA (7u) /* The read function needs a byte which indicated that no data for processing is available.*/ /* This byte shall never appear in a normal data steam */ - typedef enum - { - UART_CO2_INIT = 0, - UART_CO2_SETUP, /* collecting data needed to be read out of the sensor once at startup */ - UART_CO2_OPERATING, /* normal operation */ - } uartCO2Status_t; - - typedef enum - { - RX_Ready= 0, /* Initial state */ - RX_DetectStart, /* validate start byte */ - RX_SelectData, /* Data contained in this frame */ - RX_Data0, /* Process incoming data */ - RX_Data1, - RX_Data2, - RX_Data3, - RX_Data4, - RX_Data5, - RX_Data6, - RX_Data7, - RX_Data8, - RX_Data9, - RX_Data10, - RX_Data11, - RX_Data12, - RX_DataComplete - } receiveState_t; - - -typedef enum -{ - CO2CMD_MODE_POLL, /* Set operation mode of sensor to polling => only send data if requested */ - CO2CMD_MODE_STREAM, /* Set operation mode of sensor to streaming => send data every two seconds */ - CO2CMD_CALIBRATE, /* Calibrate sensor */ - CO2CMD_GETSCALE, /* Get scaling factor */ - CO2CMD_GETDATA /* Read sensor data */ -} co2SensorCmd_t; - void MX_USART1_UART_Init(void); void MX_USART1_UART_DeInit(void); void MX_USART1_DMA_Init(void); @@ -85,7 +47,7 @@ void UART_SendCmdString(uint8_t *cmdString); void UART_ReadData(uint8_t sensorType); void UART_FlushRxBuffer(void); - +void UART_ChangeBaudrate(uint32_t newBaudrate); void StringToInt(char *pstr, uint32_t *puInt32); void StringToUInt64(char *pstr, uint64_t *puint64);