Mercurial > public > ostc4
annotate Small_CPU/Inc/externalInterface.h @ 714:045ff7800501
Added customizable data area for specific sensor data:
In future smart sensors will be connected via UART interface. These sensor provide additional data like diagnostics or id numbers which may vary from sensor to sensor. That's why a byte array has been added which stores up to 32 bytes. The layout of this array may be specific to sensor needs. As first example temperature and id number of the DiveO2 sensor are provided.
author | Ideenmodellierer |
---|---|
date | Sun, 20 Nov 2022 20:42:08 +0100 |
parents | f1b40364b0af |
children | d646a0f724a7 |
rev | line source |
---|---|
554
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
1 /** |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
2 ****************************************************************************** |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
3 * @file externalInterface.h |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
4 * @author heinrichs weikamp gmbh |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
5 * @version V0.0.1 |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
6 * @date 07-Nov-2020 |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
7 * @brief Interface functionality to proceed external analog signal via i2c connection |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
8 * |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
9 @verbatim |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
10 ============================================================================== |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
11 ##### How to use ##### |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
12 ============================================================================== |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
13 @endverbatim |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
14 ****************************************************************************** |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
15 * @attention |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
16 * |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
17 * <h2><center>© COPYRIGHT(c) 2014 heinrichs weikamp</center></h2> |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
18 * |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
19 ****************************************************************************** |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
20 */ |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
21 |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
22 /* Define to prevent recursive inclusion -------------------------------------*/ |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
23 #ifndef EXTERNAL_INTERFACE_H |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
24 #define EXTERNAL_INTERFACE_H |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
25 |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
26 #ifdef __cplusplus |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
27 extern "C" { |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
28 #endif |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
29 |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
30 /* Includes ------------------------------------------------------------------*/ |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
31 |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
32 #define MAX_ADC_CHANNEL (3u) /* number of channels to be read */ |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
33 #define EXTERNAL_ADC_NO_DATA 0xFF |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
34 |
662 | 35 #define EXT33V_CONTROL_PIN GPIO_PIN_7 /* PortC */ |
36 | |
554
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
37 void externalInterface_Init(void); |
662 | 38 void externalInterface_InitPower33(void); |
554
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
39 uint8_t externalInterface_StartConversion(uint8_t channel); |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
40 uint8_t externalInterface_ReadAndSwitch(); |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
41 float externalInterface_CalculateADCValue(uint8_t channel); |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
42 float getExternalInterfaceChannel(uint8_t channel); |
691 | 43 uint8_t setExternalInterfaceChannel(uint8_t channel, float value); |
662 | 44 void externalInterface_SwitchPower33(uint8_t state); |
691 | 45 void externalInterface_SwitchADC(uint8_t state); |
704
f1b40364b0af
Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents:
691
diff
changeset
|
46 void externalInterface_SwitchUART(uint8_t protocol); |
691 | 47 uint8_t externalInterface_isEnabledPower33(void); |
48 uint8_t externalInterface_isEnabledADC(void); | |
704
f1b40364b0af
Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents:
691
diff
changeset
|
49 uint8_t externalInterface_GetUARTProtocol(); |
662 | 50 |
51 void externalInterface_SetCO2Value(uint16_t CO2_ppm); | |
52 void externalInterface_SetCO2SignalStrength(uint16_t LED_qa); | |
53 uint16_t externalInterface_GetCO2Value(void); | |
54 uint16_t externalInterface_GetCO2SignalStrength(void); | |
55 void externalInterface_SetCO2State(uint16_t state); | |
56 uint16_t externalInterface_GetCO2State(void); | |
714
045ff7800501
Added customizable data area for specific sensor data:
Ideenmodellierer
parents:
704
diff
changeset
|
57 uint8_t externalInterface_GetSensorData(uint8_t* pDataStruct); |
045ff7800501
Added customizable data area for specific sensor data:
Ideenmodellierer
parents:
704
diff
changeset
|
58 void externalInterface_SetSensorData(uint8_t dataId, uint8_t* pDataStruct); |
662 | 59 |
60 void externalInterface_ExecuteCmd(uint16_t Cmd); | |
554
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
61 |
3328189786e7
Added external ADC interface functionality (MCP3424):
Ideenmodellierer
parents:
diff
changeset
|
62 #endif /* EXTERNAL_INTERFACE_H */ |