-
Notifications
You must be signed in to change notification settings - Fork 0
/
Variables.hpp
273 lines (246 loc) · 4.17 KB
/
Variables.hpp
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
#pragma once
#include "mbed.h"
#include "Joystick.h"
#include "N5110.h"
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <string>
#define SP 1
#define LEN(arr) ((int) (sizeof (arr) / sizeof (arr)[0]))
#define WAIT 200ms
#define MAX_TEMP (float) 35.0
#define MIN_TEMP (float) 5.0
#define N_LIGHTS 3
#define N_DEVICES 2
#define N_APPLIANCES 3
/**
* @brief Used to print on screen
*
* @return BufferedSerial
*/
BufferedSerial pc(USBTX, USBRX);
/**
* @brief Joystick object
*
* @return Joystick
*/
Joystick joystick(PC_3, PC_2); //attach and create joystick object
/**
* @brief LCD Object
*
* @return N5110
*/
N5110 lcd(PC_7, PA_9, PB_10, PB_5, PB_3, PA_10);
/**
* @brief Right button
*
* @return DigitalIn
*/
DigitalIn right_button(PC_10);
/**
* @brief Left button
*
* @return DigitalIn
*/
DigitalIn left_button(PC_12);
/**
* @brief Main button
*
* @return DigitalIn
*/
DigitalIn main_button(PC_11);
/**
* @brief Potentiometer
*
* @return AnalogIn
*/
AnalogIn pot(PC_0);
/**
* @brief LDR sensor
*
* @return AnalogIn
*/
AnalogIn ldr_sensor(PA_1); //LDR pin
/**
* @brief Tempreature sensor
*
* @return AnalogIn
*/
AnalogIn tmp_sensor(PA_0); //TEMP Sensor pin
/**
* @brief FSR
*
* @return AnalogIn
*/
AnalogIn fsr_sensor(PA_4); //Force sensor pin
/**
* @brief Buzzer
*
* @return PwmOut
*/
PwmOut buzzer(PA_15);
/**
* @brief Output devices
*
* @return BusOut
*/
BusOut devices_out(PA_12, PA_11); // works
/**
* @brief Output appliances
*
* @return BusOut
*/
BusOut appliances_out(PB_15, PB_14, PB_13); // works
/**
* @brief Output lights
*
*/
PwmOut lights_out[N_LIGHTS] = {PwmOut(PC_8), PwmOut(PC_6), PwmOut(PB_8)};
/**
* @brief AC
*
* @return PwmOut
*/
PwmOut ac_out(PC_9);
/**
* @brief pages states
*
*/
enum State
{
HOME,
MAIN,
STANDBY,
SECURITY
};
/**
* @brief MainPage options
*
*/
enum Options
{
CHANGE_TIME, // change time
CHANGE_FLAG, // change flags
SETTINGS, // brightness and ac temp
EDIT_PERIPHERALS // edit peripherals
};
/**
* @brief Right arrow icon
*
*/
const int right_arrow[7][8] = {
{1,0,0,0,1,0,0,0},
{1,1,0,0,1,1,0,0},
{1,1,1,0,1,1,1,0},
{1,1,1,1,1,1,1,1},
{1,1,1,0,1,1,1,0},
{1,1,0,0,1,1,0,0},
{1,0,0,0,1,0,0,0}
};
/**
* @brief Home icon
*
*/
const int home_icon[7][7] = {
{0,0,0,1,0,0,0},
{0,0,1,1,1,0,0},
{0,1,1,1,1,1,0},
{1,0,0,0,0,0,1},
{1,0,1,1,1,0,1},
{1,0,1,0,1,0,1},
{1,1,1,1,1,1,1}
};
/**
* @brief Light bulb icon
*
*/
const int light_icon[7][9] = {
{0,0,1,1,1,0,0,0,0},
{0,1,0,0,0,1,0,0,0},
{1,0,1,0,1,0,1,0,1},
{1,0,1,1,1,0,1,0,0},
{0,1,1,0,1,1,0,0,1},
{0,0,1,1,1,0,0,0,0},
{0,0,1,1,1,0,0,0,0}
};
/**
* @brief AC icon
*
*/
const int ac_icon[7][11] = {
{0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,1,1,0,0},
{1,0,0,0,0,0,0,0,1,0,1},
{1,0,0,1,1,1,0,0,1,0,0},
{1,1,1,1,1,1,1,1,1,0,1},
{0,1,0,1,0,1,0,1,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0}
};
/**
* @brief False icon
*
*/
const int false_icon[7][7] = {
{0,0,0,0,0,0,0},
{0,1,0,0,0,1,0},
{0,0,1,0,1,0,0},
{0,0,0,1,0,0,0},
{0,0,1,0,1,0,0},
{0,1,0,0,0,1,0},
{0,0,0,0,0,0,0}
};
/**
* @brief Correct icon
*
*/
const int correct_icon[7][9] = {
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,1},
{0,0,0,0,0,0,0,1,0},
{1,0,0,0,0,0,1,0,0},
{0,1,0,0,0,1,0,0,0},
{0,0,1,1,1,0,0,0,0},
{0,0,0,1,0,0,0,0,0}
};
/**
* @brief Lock icon
*
*/
const int lock_icon[7][10] = {
{0,0,0,1,1,0,0,0,0,0},
{0,0,1,0,0,1,0,0,0,0},
{0,1,1,1,1,1,1,0,0,1},
{1,0,0,1,1,0,0,1,0,0},
{1,0,1,0,0,1,0,1,0,1},
{1,0,0,1,1,0,0,1,0,0},
{0,1,1,1,1,1,1,0,0,0}
};
/**
* @brief Left arrow icon
*
*/
const int left_arrow[7][8] = {
{0,0,0,1,0,0,0,1},
{0,0,1,1,0,0,1,1},
{0,1,1,1,0,1,1,1},
{1,1,1,1,1,1,1,1},
{0,1,1,1,0,1,1,1},
{0,0,1,1,0,0,1,1},
{0,0,0,1,0,0,0,1}
};
/**
* @brief MainPage icon
*
*/
const int main_icon[7][7] = {
{1,0,0,1,0,0,1},
{0,1,1,1,1,1,0},
{0,1,0,1,0,1,0},
{1,1,1,1,1,1,1},
{0,1,0,1,0,1,0},
{0,1,1,1,1,1,0},
{1,0,0,1,0,0,1}
};