forked from SRA-VJTI/sra-board-component
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patholed.c
514 lines (445 loc) · 24.1 KB
/
oled.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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
/*
* MIT License
*
* Copyright (c) 2021 Society of Robotics and Automation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "oled.h"
static const char *TAG_OLED = "oled";
#define LV_ATTRIBUTE_IMG
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG uint8_t sra_logo_map[] = {
0xf7, 0xf7, 0xf7, 0xff, /*Color of index 0*/
0x02, 0x02, 0x02, 0xff, /*Color of index 1*/
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3f, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00,
0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00,
0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00,
0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00,
0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80,
0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0,
0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0,
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0,
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x7f, 0x80, 0x7e, 0x00, 0xff, 0xc0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xe0,
0x7c, 0x00, 0x7e, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xe0, 0x1f, 0xff, 0xe0,
0x7c, 0x00, 0x7e, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xc0, 0x0f, 0xff, 0xe0,
0x78, 0x00, 0x7e, 0x00, 0x1f, 0xc0, 0x00, 0x00, 0x01, 0xff, 0xff, 0x80, 0x0f, 0xff, 0xe0,
0x78, 0x00, 0x7e, 0x00, 0x1f, 0xc0, 0x00, 0x00, 0x01, 0xff, 0xff, 0x80, 0x07, 0xff, 0xe0,
0x78, 0x07, 0xff, 0xf0, 0x1f, 0xea, 0xaa, 0xa0, 0x01, 0xff, 0xff, 0x00, 0x07, 0xff, 0xe0,
0x78, 0x0f, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf3, 0x81, 0xff, 0xff, 0x00, 0x03, 0xff, 0xe0,
0x78, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x81, 0xff, 0xfe, 0x00, 0x01, 0xff, 0xe0,
0x78, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x81, 0xff, 0xfe, 0x03, 0x01, 0xff, 0xe0,
0x78, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x81, 0xff, 0xfc, 0x03, 0x00, 0xff, 0xe0,
0x78, 0x00, 0x7e, 0x01, 0xff, 0xff, 0xff, 0xf1, 0x01, 0xff, 0xf8, 0x07, 0x80, 0xff, 0xe0,
0x78, 0x00, 0x7e, 0x00, 0x3f, 0xea, 0xaa, 0xa0, 0x01, 0xff, 0xf8, 0x0f, 0x80, 0x7f, 0xe0,
0x7c, 0x00, 0x7e, 0x00, 0x1f, 0xc0, 0x00, 0x00, 0x03, 0xff, 0xf0, 0x0f, 0xc0, 0x7f, 0xe0,
0x7c, 0x00, 0x7e, 0x00, 0x1f, 0xc0, 0x00, 0x00, 0x07, 0xff, 0xf0, 0x1f, 0xc0, 0x3f, 0xe0,
0x7f, 0x00, 0x7e, 0x00, 0x1f, 0xc0, 0x00, 0x00, 0x07, 0xff, 0xe0, 0x1f, 0xe0, 0x3f, 0xe0,
0x7f, 0xff, 0xff, 0xe0, 0x1f, 0xc0, 0x00, 0x00, 0x03, 0xff, 0xe0, 0x3f, 0xf0, 0x1f, 0xe0,
0x3f, 0xff, 0xff, 0xf0, 0x1f, 0xc0, 0x00, 0x00, 0x01, 0xff, 0xc0, 0x7f, 0xf0, 0x1f, 0xe0,
0x3f, 0xff, 0xff, 0xf0, 0x1f, 0xc0, 0x7f, 0xe1, 0x01, 0xff, 0xc0, 0x7f, 0xf8, 0x0f, 0xe0,
0x38, 0x1f, 0xff, 0xf0, 0x1f, 0xc0, 0x7f, 0xe3, 0x81, 0xff, 0x80, 0xff, 0xf8, 0x07, 0xe0,
0x38, 0x0f, 0xff, 0xf0, 0x1f, 0xc0, 0x7f, 0xe3, 0x81, 0xff, 0x00, 0xff, 0xfc, 0x07, 0xe0,
0x18, 0x00, 0x7e, 0x00, 0x1f, 0xc0, 0x7f, 0xe3, 0x81, 0xff, 0x01, 0xff, 0xfc, 0x03, 0xe0,
0x18, 0x00, 0x7e, 0x00, 0x1f, 0xc0, 0x7f, 0xc3, 0x81, 0xfe, 0x01, 0xff, 0xfe, 0x03, 0xe0,
0x0c, 0x00, 0x7e, 0x00, 0x1f, 0xc0, 0x7f, 0xc3, 0x81, 0xfe, 0x03, 0xff, 0xff, 0x01, 0xe0,
0x0c, 0x00, 0x7e, 0x00, 0x3f, 0xc0, 0x7f, 0x87, 0x81, 0xfc, 0x07, 0xff, 0xff, 0x00, 0xe0,
0x07, 0x00, 0x7e, 0x00, 0xff, 0xc0, 0x7f, 0x87, 0x81, 0xfc, 0x07, 0xff, 0xff, 0x80, 0xe0,
0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x00, 0x03, 0xff, 0xff, 0xff, 0xfe, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x00, 0x01, 0xff, 0xff, 0xff, 0xfc, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x00, 0x00, 0x7f, 0xff, 0xff, 0xf0, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x00, 0x00, 0x0f, 0xff, 0xff, 0x80, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0,
0x00, 0x00, 0x03, 0xff, 0xfe, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0,
0x00, 0x00, 0x00, 0x15, 0x40, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const lv_img_dsc_t sra_logo = {
.header.cf = LV_IMG_CF_INDEXED_1BIT,
.header.always_zero = 0,
.header.reserved = 0,
.header.w = 115,
.header.h = 64,
.data_size = 968,
.data = sra_logo_map,
};
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG uint8_t walle_map[] = {
0xfb, 0xfb, 0xfb, 0xff, /*Color of index 0*/
0x6f, 0x6f, 0x6f, 0xff, /*Color of index 1*/
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xfd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x7f, 0xeb, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xfb, 0xdd, 0xde, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xd6, 0xdd, 0xb6, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xbb, 0xda, 0xde, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x1d, 0xbf, 0xed, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x8f, 0xf2, 0x7f, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x85, 0xfd, 0xfa, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xe5, 0xff, 0xfd, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0xf7, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xef, 0xff, 0xff, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x7e, 0x07, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0xd7, 0x46, 0xf7, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xd6, 0xe7, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0e, 0xf7, 0xfe, 0x0f, 0x7b, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1e, 0x61, 0xff, 0xfc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xaa, 0xaf, 0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x17, 0xff, 0x00, 0x0f, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1b, 0xff, 0x80, 0x0f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1e, 0x61, 0x80, 0x0c, 0x37, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x0f, 0xfb, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0xf4, 0x00, 0x02, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1f, 0xfd, 0x80, 0x00, 0x00, 0x1b, 0xff, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x00, 0x1f, 0xff, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x07, 0x80, 0x00, 0x00, 0x1e, 0x00, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x35, 0x57, 0x80, 0x00, 0x00, 0x1f, 0x55, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x07, 0x80, 0x00, 0x00, 0x1e, 0x00, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3b, 0xff, 0x80, 0x00, 0x00, 0x1f, 0xff, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x07, 0xff, 0xff, 0xff, 0xfe, 0x00, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x03, 0xfe, 0x00, 0x03, 0xfe, 0x00, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3b, 0xff, 0x8e, 0x00, 0x03, 0x1f, 0xff, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x07, 0x96, 0x00, 0x03, 0x9e, 0x00, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3b, 0xff, 0xfc, 0x00, 0x01, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x07, 0xd0, 0x00, 0x00, 0xb6, 0x00, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x00, 0x00, 0x07, 0xff, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x28, 0x0a, 0x00, 0x00, 0x00, 0x05, 0x01, 0x40, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const lv_img_dsc_t walle = {
.header.cf = LV_IMG_CF_INDEXED_1BIT,
.header.always_zero = 0,
.header.reserved = 0,
.header.w = 108,
.header.h = 48,
.data_size = 680,
.data = walle_map,
};
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG uint8_t mario_map[] = {
0xfc, 0xfc, 0xfc, 0xff, /*Color of index 0*/
0x0f, 0x0f, 0x0f, 0xff, /*Color of index 1*/
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfc, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xfe, 0x7e, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x28, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfe, 0x01, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf8, 0x07, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x87, 0xf0, 0x03, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe7, 0xe0, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0x80, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x3f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0x7f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x3f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x7f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf2, 0x00, 0x00, 0x3f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xe7, 0x00, 0x00, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x00, 0x01, 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x80, 0x03, 0x80, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xc0, 0x03, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xe0, 0x01, 0x80, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xf0, 0x01, 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xf8, 0x00, 0xe1, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xf8, 0x00, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x15, 0x55, 0x55, 0x55, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const lv_img_dsc_t mario = {
.header.cf = LV_IMG_CF_INDEXED_1BIT,
.header.always_zero = 0,
.header.reserved = 0,
.header.w = 122,
.header.h = 48,
.data_size = 776,
.data = mario_map,
};
LV_IMG_DECLARE(sra_logo);
LV_IMG_DECLARE(walle);
LV_IMG_DECLARE(mario);
lv_color_t *buf_1[DISP_BUF_SIZE];
lv_disp_draw_buf_t disp_buf;
lv_disp_drv_t disp_drv;
esp_err_t init_oled()
{
lv_init();
// Initialize I2C bus used by the drivers
lvgl_i2c_driver_init(OLED_SDA, OLED_SCL, OLED_IIC_FREQ_HZ);
ssd1306_init();
uint32_t size_in_px = DISP_BUF_SIZE * 8;
// Initialize the working buffer depending on the selected display
lv_disp_draw_buf_init(&disp_buf, buf_1, NULL, size_in_px);
lv_disp_drv_init(&disp_drv);
disp_drv.hor_res = 128;
disp_drv.ver_res = 64;
disp_drv.flush_cb = ssd1306_flush;
disp_drv.rounder_cb = ssd1306_rounder;
disp_drv.set_px_cb = ssd1306_set_px_cb;
disp_drv.draw_buf = &disp_buf;
lv_disp_drv_register(&disp_drv);
// Display SRA logo
display_logo(SRA_LOGO);
vTaskDelay(100);
// Display Wall-E logo
display_logo(WALLE_LOGO);
// Clear the screen
lv_obj_clean(lv_scr_act());
ESP_LOGI(TAG_OLED, "Configured OLED Display");
return ESP_OK;
}
esp_err_t display_logo(int logo_id)
{
// Clear the screen
lv_obj_clean(lv_scr_act());
lv_obj_t *logo = lv_img_create(lv_scr_act());
lv_obj_t *text = lv_label_create(lv_scr_act());
switch(logo_id)
{
case SRA_LOGO:
// Draw SRA logo on the screen
lv_img_set_src(logo, &sra_logo);
lv_obj_set_size(logo, 115, 64);
lv_obj_align(logo, LV_ALIGN_CENTER, 0, 0);
ESP_LOGI(TAG_OLED, "Displayed SRA logo on OLED Screen");
lv_obj_del(text);
break;
case WALLE_LOGO:
// Draw Wall-E logo on the screen
lv_img_set_src(logo, &walle);
lv_obj_set_size(logo, 108, 48);
lv_obj_align(logo, LV_ALIGN_OUT_TOP_MID, 0, 0);
// print "Wall-e" text on the screen
lv_label_set_text(text, WALLE_TEXT);
lv_obj_set_size(text, lv_obj_get_self_width(text), 16);
lv_obj_set_pos(text, 16, 48);
ESP_LOGI(TAG_OLED, "Displayed Wall-E logo on OLED Screen");
break;
case MARIO_LOGO:
// Draw Mario logo on the screen
lv_img_set_src(logo, &mario);
lv_obj_set_size(logo, 108, 48);
lv_obj_align(logo, LV_ALIGN_OUT_TOP_MID, 0, 0);
// print "Mario" text on the screen
lv_label_set_text(text, MARIO_TEXT);
lv_obj_set_size(text, lv_obj_get_self_width(text), 16);
lv_obj_set_pos(text, 16, 48);
ESP_LOGI(TAG_OLED, "Displayed MARIO logo on OLED Screen");
break;
}
// Refresh Display
lv_refr_now(NULL);
return ESP_OK;
}
esp_err_t display_lsa(line_sensor_array readings)
{
// Clear the screen
lv_obj_clean(lv_scr_act());
static lv_color_t cbuf[LV_CANVAS_BUF_SIZE_INDEXED_1BIT(128, 64)];
lv_obj_t *canvas = lv_canvas_create(lv_scr_act());
lv_canvas_set_buffer(canvas, cbuf, 128, 64, LV_IMG_CF_INDEXED_1BIT);
lv_canvas_set_palette(canvas, 0, lv_color_white());
lv_canvas_set_palette(canvas, 1, lv_color_black());
lv_color_t c0;
lv_color_t c1;
c0.full = 0;
c1.full = 1;
for (uint32_t i = 0; i < 5; i++)
{
// Horizontal Border of Bar
for (uint32_t x = 18 + i * 20; x < 28 + i * 20; x++)
{
lv_canvas_set_px_color(canvas, x, 2, c1);
lv_canvas_set_px_color(canvas, x, 52, c1);
}
// Vertical Border of Bar
for (uint32_t y = 2; y < 53; y++)
{
lv_canvas_set_px_color(canvas, 18 + i * 20, y, c1);
lv_canvas_set_px_color(canvas, 28 + i * 20, y, c1);
}
// Reset Bar to Black
for (uint32_t a = 51; a > 2; a--)
{
for (uint32_t b = 19 + i * 20; b < 28 + i * 20; b++)
{
lv_canvas_set_px_color(canvas, b, a, c0);
}
}
// Set Bar value according to LSA
for (uint32_t a = 52; a > 100 - (int)(readings.adc_reading[4 - i] * 0.1); a--)
{
for (uint32_t b = 19 + i * 20; b < 28 + i * 20; b++)
{
lv_canvas_set_px_color(canvas, b, a, c1);
}
}
}
// Refresh Display
lv_refr_now(NULL);
return ESP_OK;
}
esp_err_t display_mpu(float pitch, float roll)
{
// Clear the screen
lv_obj_clean(lv_scr_act());
// Printing pitch on oled
lv_obj_t *pitch_reading = lv_label_create(lv_scr_act());
char pitch_str[20];
sprintf(pitch_str, "Pitch : %0.2f", pitch);
lv_label_set_text(pitch_reading, pitch_str);
lv_obj_set_pos(pitch_reading, 0, 18);
lv_obj_set_size(pitch_reading, 96 , lv_obj_get_self_height(pitch_reading));
// Printing roll on oled
lv_obj_t *roll_reading = lv_label_create(lv_scr_act());
char roll_str[20];
sprintf(roll_str, "Roll : %0.2f", roll);
lv_label_set_text(roll_reading, roll_str);
lv_obj_set_pos(roll_reading, 0, 36);
lv_obj_set_size(pitch_reading, 96 , lv_obj_get_self_height(pitch_reading));
// Create Meter for Pitch Readings
lv_obj_t * meter = lv_meter_create(lv_scr_act());
lv_obj_set_pos(meter, 64, 0);
lv_obj_set_size(meter, 64, 64);
// Set scale of meter and ticks
lv_meter_scale_t * scale = lv_meter_add_scale(meter);
lv_meter_set_scale_range(meter, scale, 40, -70, 180, 270);
lv_meter_set_scale_ticks(meter, scale, 19, 1, 4, lv_color_black());
lv_meter_set_scale_major_ticks(meter, scale, 9, 1, 4, lv_color_black(), 10);
// Add Needle
lv_meter_indicator_t * indic;
indic = lv_meter_add_needle_line(meter, scale, 2, lv_color_black(), -10);
lv_meter_set_indicator_value(meter, indic, pitch);
// Refresh Display
lv_refr_now(NULL);
return ESP_OK;
}
esp_err_t display_pid_values(float kp, float ki, float kd)
{
// Clear the screen
lv_obj_clean(lv_scr_act());
char kp_str[10], ki_str[10], kd_str[10];
lv_obj_t *scr = lv_disp_get_scr_act(NULL);
lv_obj_t* text[3];
for (int i = 0; i < 3; ++i)
{
text[i] = lv_label_create(scr);
}
// Printing kp value on oled
snprintf(kp_str, sizeof(kp_str), "Kp: %0.2f", kp);
lv_label_set_text(text[0], kp_str);
// Printing ki value on oled
snprintf(ki_str, sizeof(ki_str), "Ki: %0.2f", ki);
lv_label_set_text(text[1], ki_str);
// Printing kd value on oled
snprintf(kd_str, sizeof(kd_str), "Kd: %0.2f", kd);
lv_label_set_text(text[2], kd_str);
for (int i = 0; i < 3; ++i)
{
lv_obj_set_size(text[i], lv_obj_get_self_width(text[i]), 16);
lv_obj_set_pos(text[i], 30 * i, 16 * (i + 1));
}
// Refresh Display
lv_refr_now(NULL);
return ESP_OK;
}
esp_err_t display_servo_values(int s1, int s2, int s3, int s4)
{
// Clear the screen
lv_obj_clean(lv_scr_act());
char sA_str[20], sB_str[20], sC_str[20], sD_str[20];
lv_obj_t *scr = lv_disp_get_scr_act(NULL);
lv_obj_t *text[4];
for (int i = 0; i < 4; ++i)
{
text[i] = lv_label_create(scr);
}
// Printing Base angle value on oled
snprintf(sA_str, sizeof(sA_str), "Base : %d", s1);
lv_label_set_text(text[0], sA_str);
// Printing Shoulder angle value on oled
snprintf(sB_str, sizeof(sB_str), "Shoulder : %d", s2);
lv_label_set_text(text[1], sB_str);
// Printing Elbow angle C value on oled
snprintf(sC_str, sizeof(sC_str), "Elbow : %d", s3);
lv_label_set_text(text[2], sC_str);
// Printing Claw angle value on oled
snprintf(sD_str, sizeof(sD_str), "Claw : %d", s4);
lv_label_set_text(text[3], sD_str);
for (int i = 0; i < 4; ++i)
{
lv_obj_set_size(text[i], lv_obj_get_self_width(text[i]), 16);
lv_obj_set_pos(text[i], 0, 16 * i);
}
// Refresh Display
lv_refr_now(NULL);
return ESP_OK;
}