comparison Small_CPU/Inc/externalInterface.h @ 794:bb37d4f3e50e

Restructure UART based sensor handling: In the previous version every UART sensor instance had its own protocol handling instance (requests, timeout, errors). With the introduction of the multiplexer these functionalities had to be harmonized. E.g. only one errorhandling which is applied to all sensors. In the new structure the sensor communication is split into one function which takes care for the control needs of a sensor and one function which handles the incoming data. The functions behalf the same independend if the sensor are connected to multiplexer or directly to the OSTC. Second big change in the external sensor concepts is that the data processing is no longer focussed at the three existing ADC channels. Every external sensor (up to 3 ADC and 4 UART) sensor has its own instance. If the ADC slots are not in use then they may be used for visiualization of UART sensors by creating a mirror instance but this is no longer a must.
author Ideenmodellierer
date Mon, 31 Jul 2023 19:46:29 +0200
parents 19ab6f3ed52a
children e9eba334b942
comparison
equal deleted inserted replaced
793:9da81033ad44 794:bb37d4f3e50e
27 extern "C" { 27 extern "C" {
28 #endif 28 #endif
29 29
30 /* Includes ------------------------------------------------------------------*/ 30 /* Includes ------------------------------------------------------------------*/
31 #include "configuration.h" 31 #include "configuration.h"
32 32 #include "data_central.h"
33 #include "data_exchange.h"
33 34
34 #define MAX_ADC_CHANNEL (3u) /* number of channels to be read */ 35 #define MAX_ADC_CHANNEL (3u) /* number of channels to be read */
35 #define MAX_MUX_CHANNEL (4u) /* number of channels provided by the UART multiplexer */ 36 #define MAX_MUX_CHANNEL (4u) /* number of channels provided by the UART multiplexer */
36 #define EXTERNAL_ADC_NO_DATA 0xFF 37 #define EXTERNAL_ADC_NO_DATA 0xFF
37 38
38 #define EXT33V_CONTROL_PIN GPIO_PIN_7 /* PortC */ 39 #define EXT33V_CONTROL_PIN GPIO_PIN_7 /* PortC */
39 40
40 #define MIN_ADC_VOLTAGE_MV (5.0f) /* miminal voltage to rate an ADC channel as active */ 41 #define MIN_ADC_VOLTAGE_MV (5.0f) /* miminal voltage to rate an ADC channel as active */
41 42
43 #define COMMON_SENSOR_STATE_INIT (0x0u) /* All individual state definitions shall start with a INIT state = 0 */
44 #define COMMON_SENSOR_STATE_INVALID (0xFFu) /* All individual state devinitions shall not use 0xFF for operation control */
42 45
43 typedef enum 46 typedef enum
44 { 47 {
45 DETECTION_OFF = 0, /* no detection requested */ 48 DETECTION_OFF = 0, /* no detection requested */
46 DETECTION_INIT, /* prepare external interface for operation if not already activated */ 49 DETECTION_INIT, /* prepare external interface for operation if not already activated */
76 void externalInterface_SwitchPower33(uint8_t state); 79 void externalInterface_SwitchPower33(uint8_t state);
77 void externalInterface_SwitchADC(uint8_t state); 80 void externalInterface_SwitchADC(uint8_t state);
78 void externalInterface_SwitchUART(uint8_t protocol); 81 void externalInterface_SwitchUART(uint8_t protocol);
79 uint8_t externalInterface_isEnabledPower33(void); 82 uint8_t externalInterface_isEnabledPower33(void);
80 uint8_t externalInterface_isEnabledADC(void); 83 uint8_t externalInterface_isEnabledADC(void);
81 uint8_t externalInterface_GetUARTProtocol(); 84 uint8_t externalInterface_GetUARTProtocol(void);
82 85 void externalInterface_HandleUART(void);
86 void externalInterface_SetCO2Scale(float CO2Scale);
87 float externalInterface_GetCO2Scale(void);
83 void externalInterface_SetCO2Value(uint16_t CO2_ppm); 88 void externalInterface_SetCO2Value(uint16_t CO2_ppm);
84 void externalInterface_SetCO2SignalStrength(uint16_t LED_qa); 89 void externalInterface_SetCO2SignalStrength(uint16_t LED_qa);
85 uint16_t externalInterface_GetCO2Value(void); 90 uint16_t externalInterface_GetCO2Value(void);
86 uint16_t externalInterface_GetCO2SignalStrength(void); 91 uint16_t externalInterface_GetCO2SignalStrength(void);
87 void externalInterface_SetCO2State(uint16_t state); 92 void externalInterface_SetCO2State(uint16_t state);
91 void externalInface_SetSensorMap(uint8_t* pMap); 96 void externalInface_SetSensorMap(uint8_t* pMap);
92 uint8_t* externalInterface_GetSensorMapPointer(uint8_t finalMap); 97 uint8_t* externalInterface_GetSensorMapPointer(uint8_t finalMap);
93 void externalInterface_AutodetectSensor(void); 98 void externalInterface_AutodetectSensor(void);
94 void externalInterface_ExecuteCmd(uint16_t Cmd); 99 void externalInterface_ExecuteCmd(uint16_t Cmd);
95 100
101 uint8_t externalInterface_GetActiveUartSensor(void);
102 void externalInterface_SetSensorState(uint8_t sensorIdx, uint8_t state);
103 uint8_t externalInterface_GetSensorState(uint8_t sensorIdx);
104
105
106
96 #endif /* EXTERNAL_INTERFACE_H */ 107 #endif /* EXTERNAL_INTERFACE_H */