-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_kernel.c
305 lines (266 loc) · 6.93 KB
/
auto_kernel.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
// NOTICE: do not edit this file it is autogenerated
struct state
{
// Desired interval between writes to system log
unsigned long LOG_INTERVAL;
// Maximum log size
unsigned long MAX_LOG_SIZE;
// Time that alarms are suspended for by user pressing the "Alarm
// silence" button.
byte ALARM_SUSPEND_DURATION;
// Patient weight
unsigned int PATIENT_WEIGHT;
// Patient height, required for calculating ideal body weight
unsigned int PATIENT_HEIGHT;
// Patient gender, required for calculating ideal body weight
enum PATIENT_GENDER;
// Ideal body weight, used for expressing volumes in terms of ml per kg
// of ideal weight.
unsigned int IDEAL_BODY_WEIGHT;
// Desired tidal volume [VCV, PRVC]
unsigned int TV;
// Desired inspiratory pressure (Pi), [PSV, PCV]
int SET_PI;
// inspiration trigger [PSV]
byte INSPIRATION_FLOW_TRIGGER;
// inspiration trigger [PSV]
byte INSP_P_TRIGGER;
// expiratory termination trigger (percent of peak inspiratory flow)
// (PSV)
byte EXP_TERMINATION_TRIGGER;
// inspiratory time (which together with respiratory rate imply IE)
unsigned int INSP_TIME;
// In PCV and VCV modes this is the rate, however synchronised modes this
// value is the minimum rate.
byte MIN_RR;
// PEEP
byte SET_PEEP;
// FiO2
byte SET_FIO2;
enum VENTILATION_MODE;
// Battery status
byte BATTERY;
// Mains electricity power supply status
unsigned int MAINS;
// Combined battery and mains power status
byte POWER;
// Oxygen supply line pressure
unsigned int OXYGEN_LINE;
// Air supply line pressure
unsigned int AIR_LINE;
// Internal ventilator temperature
unsigned int TEMPERATURE;
// Observed circuit pressure
int P;
// Observed respiratory rate
unsigned int RR;
// Primary pressure sensor value
int P1;
// Secondary pressure sensor value
int P2;
// Gas flow recorded by the inspiratory manifold sensor
unsigned int FI;
// Gas flow recorded by the expiratory manifold sensor
unsigned int FE;
// Gas flow recorded by both sensors and smoothed
int FLOW;
// Fraction of gas that is oxygen at the patient airway
unsigned int FO2;
// Partial pressure of CO2 measured at the patient airway
byte PCO2;
// flag to indicate phase of respiratory cycle
bool INSPIRING;
// Pi with some smoothing applied
unsigned int PI;
// Peak observed pressure
unsigned int PEAK_PI;
// PEEP
unsigned int PEEP;
// TVi
unsigned int TVI;
// TVe
unsigned int TVE;
// Minute volume (the product of respiratory rate and tidal volume)
unsigned int MV;
// FiO2
byte FIO2;
// FeO2
byte FEO2;
// EtCO2
byte ETCO2;
// inspired CO2 partial pressure
byte ICO2;
// last time the system wrote to the log
unsigned long LAST_LOG_TIME;
// Alarm suspended time
unsigned long ALARM_SUSPENDED_TIME;
};
void MAIN(struct State *state)
{
hook_pre_MAIN(state); // call all pre hooks
core_MAIN(state); // call core code
hook_post_MAIN(state); // call all post hooks
}
void hook_pre_MAIN(struct State *state)
{
; // no pre_MAIN hooks
}
void hook_post_MAIN(struct State *state)
{
; // no post_MAIN hooks
}
void START(struct State *state)
{
hook_pre_START(state); // call all pre hooks
core_START(state); // call core code
hook_post_START(state); // call all post hooks
}
void hook_pre_START(struct State *state)
{
; // no pre_START hooks
}
void hook_post_START(struct State *state)
{
; // no post_START hooks
}
void LOOP(struct State *state)
{
hook_pre_LOOP(state); // call all pre hooks
core_LOOP(state); // call core code
hook_post_LOOP(state); // call all post hooks
}
void hook_pre_LOOP(struct State *state)
{
; // no pre_LOOP hooks
}
void hook_post_LOOP(struct State *state)
{
; // no post_LOOP hooks
}
void STOP(struct State *state)
{
hook_pre_STOP(state); // call all pre hooks
core_STOP(state); // call core code
hook_post_STOP(state); // call all post hooks
}
void hook_pre_STOP(struct State *state)
{
; // no pre_STOP hooks
}
void hook_post_STOP(struct State *state)
{
; // no post_STOP hooks
}
void CHECK(struct State *state)
{
hook_pre_CHECK(state); // call all pre hooks
core_CHECK(state); // call core code
hook_post_CHECK(state); // call all post hooks
}
void hook_pre_CHECK(struct State *state)
{
; // no pre_CHECK hooks
}
void hook_post_CHECK(struct State *state)
{
; // no post_CHECK hooks
}
void ALARM(struct State *state)
{
hook_pre_ALARM(state); // call all pre hooks
core_ALARM(state); // call core code
hook_post_ALARM(state); // call all post hooks
}
void hook_pre_ALARM(struct State *state)
{
; // no pre_ALARM hooks
}
void hook_post_ALARM(struct State *state)
{
; // no post_ALARM hooks
}
void SENSE(struct State *state)
{
hook_pre_SENSE(state); // call all pre hooks
core_SENSE(state); // call core code
hook_post_SENSE(state); // call all post hooks
}
void hook_pre_SENSE(struct State *state)
{
; // no pre_SENSE hooks
}
void hook_post_SENSE(struct State *state)
{
; // no post_SENSE hooks
}
void THINK(struct State *state)
{
hook_pre_THINK(state); // call all pre hooks
core_THINK(state); // call core code
hook_post_THINK(state); // call all post hooks
}
void hook_pre_THINK(struct State *state)
{
; // no pre_THINK hooks
}
void hook_post_THINK(struct State *state)
{
hook_post_THINK_BLUETOOTH(state);
hook_post_THINK_SUPER_PRVC(state);
}
void DRIVE(struct State *state)
{
hook_pre_DRIVE(state); // call all pre hooks
core_DRIVE(state); // call core code
hook_post_DRIVE(state); // call all post hooks
}
void hook_pre_DRIVE(struct State *state)
{
; // no pre_DRIVE hooks
}
void hook_post_DRIVE(struct State *state)
{
; // no post_DRIVE hooks
}
void LOG(struct State *state)
{
hook_pre_LOG(state); // call all pre hooks
core_LOG(state); // call core code
hook_post_LOG(state); // call all post hooks
}
void hook_pre_LOG(struct State *state)
{
hook_pre_LOG_SUPER_PRVC(state);
}
void hook_post_LOG(struct State *state)
{
hook_post_LOG_BLUETOOTH(state);
}
void DISPLAY(struct State *state)
{
hook_pre_DISPLAY(state); // call all pre hooks
core_DISPLAY(state); // call core code
hook_post_DISPLAY(state); // call all post hooks
}
void hook_pre_DISPLAY(struct State *state)
{
; // no pre_DISPLAY hooks
}
void hook_post_DISPLAY(struct State *state)
{
; // no post_DISPLAY hooks
}
void READ(struct State *state)
{
hook_pre_READ(state); // call all pre hooks
core_READ(state); // call core code
hook_post_READ(state); // call all post hooks
}
void hook_pre_READ(struct State *state)
{
; // no pre_READ hooks
}
void hook_post_READ(struct State *state)
{
; // no post_READ hooks
}