-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheHealthDisplay.h
More file actions
241 lines (180 loc) · 6.17 KB
/
eHealthDisplay.h
File metadata and controls
241 lines (180 loc) · 6.17 KB
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
/*
* eHealth sensor platform for Arduino and Raspberry from Cooking-hacks.
*
* Description: "The e-Health Sensor Shield allows Arduino and Raspberry Pi
* users to perform biometric and medical applications by using 9 different
* sensors: Pulse and Oxygen in Blood Sensor (SPO2), Airflow Sensor (Breathing),
* Body Temperature, Electrocardiogram Sensor (ECG), Glucometer, Galvanic Skin
* Response Sensor (GSR - Sweating), Blood Pressure (Sphygmomanometer) and
* Patient Position (Accelerometer)."
*
* Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L.
* http://www.libelium.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Version 0.1
* Author: Luis Martín & Ahmad Saad
*/
// ensure this library description is only included once
#ifndef eHealthClassDisplay_h
#define eHealthClassDisplay_h
#include "Arduino.h"
#include <avr/pgmspace.h>
// Library interface description
class eHealthDisplayClass {
public:
//***************************************************************
// Constructor of the class *
//***************************************************************
//! Class constructor.
eHealthDisplayClass(void);
//***************************************************************
// Public Methods *
//***************************************************************
//! Configure and initializes the LCD.
/*!
\param void
\return void
*/ void init(void);
//! Configure some parameters of the values screen.
/*!
\param void
\return void
*/ void initValuesScreen();
//! It prints (refresh) the values of the sensors in the screen.
/*!
\param void
\return void
*/ void printValuesScreen();
//! Configure some parameters of the ECG screen.
/*!
\param void
\return void
*/ void initECGScreen(void);
//! It prints (refresh) the ECG wave in the LCD screen.
/*!
\param void
\return void
*/ void printECGScreen(void);
//! Configure some parameters of the AirFlow screen.
/*!
\param void
\return void
*/ void initAirFlowScreen();
//! It prints (refresh) the AirFlow wave in the LCD screen.
/*!
\param void
\return void
*/ void printAirFlowScreen(void);
//***************************************************************
// Private Methods *
//***************************************************************
private:
//! Clear all data writed in the LCD.
void clearLCD(void);
//! It writes data in decimal format.
void writeLcdDec(int data);
//! It prints data in the LCD.
void writeLCD(char *data);
//! It prints a back space in the LCD.
void backspace();
/*! It changes the baud rate uart communication with the LCD.
"1" = 4.800bps "2" = 96,00bps
"3" = 19,200bps "4" = 38,400bps
"5" = 57,600bps "6" = 115,200bps
*/
void changeBaudrate(char frec);
//! It places the write pointer in the x-y position.
void coordinates(int x, int y);
//! It activates or deactivates a pixel.
void pixel (int x, int y, int onOff);
//! It draws or erases a line.
void line (int fromX, int fromY, int toX, int toY, int onOff);
//! It draws or erases a circule.
void circle (int x, int y, int radio, int onOff);
//! It draws or erases a rectangle.
void rectangle (int fromX, int fromY,
int toX,
int toY,
int onOff);
//! It clears an area of the LCD.
void clearSpace (int fromX, int fromY, int toX, int toY);
//! It draws an image stored in an array.
void image (int desde_x,
int desde_y,
int ancho,
int alto,
PROGMEM prog_uint8_t *array);
//! It prints a lung in the AirFlow screen.
void printLung(uint8_t onOff);
//!It prints the apnea advise.
void apneaAdvise(uint8_t onOff);
//! It prints a heart in the LCD.
void printHeart(uint8_t onOff);
//! It prints a guy in stand/sit position.
void standPosition();
//! It prints a guy in rigth lateral position.
void rigthLateralPosition();
//! It prints a guy in letf lateral position.
void leftLateralPosition();
//! It prints a guy in supine position.
void supinePosition();
//! It prints a guy in prone position.
void pronePosition();
//***************************************************************
// Private Variables *
//***************************************************************
//! It stores the number of breaths or beats.
int count;
//! It stores the current value of the ECG or AirFlow sensor.
int valRead;
//! It stores the previous value of the ECG or AirFlow sensor.
int prevRead;
//! Number of counts per minute. It stores the number of
//! breaths in air flow, and the number of beats in ECG.
int countsPerMinute;
//! The previous value of time.
long timePrevious;
//! It stores the time when the last measure was taked.
long timePreviousMeassure;
//! The current time.
long time;
//! Previous value of count variable.
long countPrevious ;
//! Vairable who indicates the current state of the wave.
uint8_t waveState;
//! It stores the current value of x position in the LCD.
uint8_t x;
//! It stores the current value of y position in the LCD.
uint8_t y;
//! Auxiliar variable.
int z;
//! Auxiliar variable.
int q;
//! Auxiliar variable.
int a;
//! The final size of the image.
int final;
//! An auxiliar variable.
unsigned char temp;
//! It stores the current body position.
uint8_t bodyPosition;
//! It stores the current blood oxygen saturation.
uint8_t oxygen;
//! It stores the current value of pulse.
uint8_t pulse;
};
extern eHealthDisplayClass eHealthDisplay;
#endif