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 SENSOR_PRESSURE_ID 0
|
|
33 #define MAX_SENSORS 1
|
181
|
34
|
207
|
35 #define SPI_SYNC_METHOD_NONE (0u)
|
|
36 #define SPI_SYNC_METHOD_HARD (1u) /* Scheduler shall reset all counters to 0 */
|
|
37 #define SPI_SYNC_METHOD_SOFT (2u) /* Scheduler shall reset adjust counters to 100ms SPI data exchange cycle */
|
|
38 #define SPI_SYNC_METHOD_INVALID (4u)
|
|
39
|
38
|
40 typedef struct
|
|
41 {
|
|
42 uint8_t mode;
|
|
43 short conservatism;
|
|
44 short repetitive_dive;
|
|
45 long seconds_since_last_dive;
|
|
46 long no_fly_time_minutes;
|
|
47 uint8_t whichGas;
|
|
48 SGas aktualGas[2];
|
|
49 float ceiling_from_main_CPU_mbar;
|
|
50 SLifeData lifeData;
|
|
51 SVpm vpm;
|
|
52 SSettings settings;
|
|
53 SDevice deviceData;
|
|
54 SDataExchangeSlaveToMasterDeviceData deviceDataSendToMaster;
|
|
55 SDataExchangeSlaveToMaster dataSendToMaster;
|
|
56 SDataReceiveFromMaster dataSendToSlave;
|
|
57 _Bool demo_mode;
|
|
58 uint8_t dataSendToSlaveIsValid;
|
|
59 uint8_t dataSendToSlavePending;
|
88
|
60 uint8_t dataSendToSlaveStopEval;
|
38
|
61 uint32_t sync_error_count;
|
|
62 uint32_t check_sync_not_running;
|
|
63 uint8_t ButtonResponsiveness[4];
|
|
64 uint8_t chargerStatus;
|
|
65 uint8_t dataSendToSlaveIsNotValidCount;
|
|
66 uint8_t ButtonPICdata[4];
|
|
67 uint8_t accidentFlag;
|
|
68 uint32_t accidentRemainingSeconds;
|
|
69 uint8_t sensorError[MAX_SENSORS];
|
|
70 uint8_t I2C_SystemStatus;
|
|
71 } SGlobal;
|
|
72
|
|
73 typedef struct
|
|
74 {
|
|
75 long seconds_since_last_dive;
|
|
76 long no_fly_time_minutes;
|
|
77 } SBackup;
|
|
78
|
144
|
79 typedef struct
|
|
80 {
|
|
81 uint8_t counterSPIdata100msec;
|
|
82 uint8_t counterPressure100msec;
|
|
83 uint8_t counterCompass100msec;
|
|
84 uint8_t counterAmbientLight100msec;
|
|
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
|
207
|
108 void Scheduler_Request_sync_with_SPI(uint8_t SyncMethod);
|
|
109 void Scheduler_SyncToSPI(void);
|
|
110
|
38
|
111 uint8_t scheduleSetButtonResponsiveness(void);
|
|
112
|
|
113 void copyBatteryData(void);
|
|
114
|
|
115 //void scheduleSurfaceMode_test(void);
|
|
116 //void scheduleSleepMode_test(void);
|
|
117
|
|
118 #ifdef __cplusplus
|
|
119 }
|
|
120 #endif
|
|
121
|
|
122 #endif /* SCHEDULER_H */
|
|
123
|
|
124 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/
|