38
|
1 /**
|
|
2 ******************************************************************************
|
|
3 * @file scheduler.h
|
|
4 * @author heinrichs weikamp gmbh
|
|
5 * @version V0.0.5
|
|
6 * @date 27-March-2014
|
|
7 * @brief
|
|
8 *
|
|
9 ******************************************************************************
|
|
10 * @attention
|
|
11 *
|
|
12 * <h2><center>© COPYRIGHT(c) 2015 heinrichs weikamp</center></h2>
|
|
13 *
|
|
14 ******************************************************************************
|
|
15 */
|
|
16
|
|
17
|
|
18 #ifndef SCHEDULER_H
|
|
19 #define SCHEDULER_H
|
|
20
|
|
21 #ifdef __cplusplus
|
|
22 extern "C" {
|
|
23 #endif
|
|
24
|
|
25
|
|
26 /* Includes ------------------------------------------------------------------*/
|
|
27 #include "data_central.h"
|
|
28 #include "data_exchange.h"
|
|
29 #include "settings.h"
|
|
30
|
|
31 /* Types -------------------------------------------------------------*/
|
|
32 #define MAX_WIRELESS_BYTES 10
|
|
33 #define SENSOR_PRESSURE_ID 0
|
|
34 #define MAX_SENSORS 1
|
|
35
|
|
36 typedef struct
|
|
37 {
|
|
38 uint8_t mode;
|
|
39 short conservatism;
|
|
40 short repetitive_dive;
|
|
41 long seconds_since_last_dive;
|
|
42 long no_fly_time_minutes;
|
|
43 uint8_t whichGas;
|
|
44 SGas aktualGas[2];
|
|
45 float ceiling_from_main_CPU_mbar;
|
|
46 SLifeData lifeData;
|
|
47 SVpm vpm;
|
|
48 SSettings settings;
|
|
49 SDevice deviceData;
|
|
50 SDataExchangeSlaveToMasterDeviceData deviceDataSendToMaster;
|
|
51 SDataExchangeSlaveToMaster dataSendToMaster;
|
|
52 SDataReceiveFromMaster dataSendToSlave;
|
|
53 _Bool demo_mode;
|
|
54 uint8_t dataSendToSlaveIsValid;
|
|
55 uint8_t dataSendToSlavePending;
|
88
|
56 uint8_t dataSendToSlaveStopEval;
|
38
|
57 uint32_t sync_error_count;
|
|
58 uint32_t check_sync_not_running;
|
|
59 uint8_t ButtonResponsiveness[4];
|
|
60 uint8_t chargerStatus;
|
|
61 uint8_t dataSendToSlaveIsNotValidCount;
|
|
62 uint8_t wirelessdata[MAX_WIRELESS_BYTES];
|
|
63 uint8_t wirelessReceived;
|
|
64 uint8_t wirelessConfidenceStatus;
|
|
65 uint8_t ButtonPICdata[4];
|
|
66 uint8_t accidentFlag;
|
|
67 uint32_t accidentRemainingSeconds;
|
|
68 uint8_t sensorError[MAX_SENSORS];
|
|
69 uint8_t I2C_SystemStatus;
|
|
70 } SGlobal;
|
|
71
|
|
72 typedef struct
|
|
73 {
|
|
74 long seconds_since_last_dive;
|
|
75 long no_fly_time_minutes;
|
|
76 } SBackup;
|
|
77
|
144
|
78 typedef struct
|
|
79 {
|
|
80 uint8_t counterSPIdata100msec;
|
|
81 uint8_t counterPressure100msec;
|
|
82 uint8_t counterCompass100msec;
|
|
83 uint8_t counterAmbientLight100msec;
|
|
84 uint16_t counterWireless1msec;
|
|
85 uint32_t tickstart;
|
|
86 } SScheduleCtrl;
|
|
87
|
|
88
|
38
|
89 /* Variables ---------------------------------------------------------*/
|
|
90 extern SGlobal global;
|
|
91
|
|
92
|
|
93 /* Function prototypes -----------------------------------------------*/
|
|
94
|
|
95 void initGlobals(void);
|
|
96
|
|
97 void scheduleSurfaceMode(void);
|
|
98 void scheduleDiveMode(void);
|
|
99 void scheduleSleepMode(void);
|
|
100 void scheduleCompassCalibrationMode(void);
|
|
101 void scheduleTestMode(void);
|
|
102
|
|
103 void scheduleUpdateLifeData(int32_t asynchron_milliseconds_since_last);
|
|
104 void scheduleSpecial_Evaluate_DataSendToSlave(void);
|
|
105 void scheduleUpdateDeviceDataChargerFull(void);
|
|
106 void scheduleUpdateDeviceDataChargerCharging(void);
|
|
107
|
|
108 uint8_t scheduleSetButtonResponsiveness(void);
|
|
109
|
|
110 void copyBatteryData(void);
|
|
111
|
|
112 //void scheduleSurfaceMode_test(void);
|
|
113 //void scheduleSleepMode_test(void);
|
|
114
|
|
115 #ifdef __cplusplus
|
|
116 }
|
|
117 #endif
|
|
118
|
|
119 #endif /* SCHEDULER_H */
|
|
120
|
|
121 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/
|