-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootloader.cpp
68 lines (43 loc) · 1.12 KB
/
bootloader.cpp
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
#if defined TEENSYDUINO || defined ARDUINO_AVR_NANO
#include "defines.h"
#include "bootloader.h"
#include "paint.h"
#include "pixel_dual.h"
#ifdef TEENSYDUINO
#define RENDERER dual
#define BOOT_DELAY 2000
#else
#define RENDERER strip[0]
#define BOOT_DELAY 10
#endif
void bootloader::frame(pixelArray **strip, WII **wii) {
if (!loaded) {
if (elapsed < BOOT_DELAY) return;
elapsed -= BOOT_DELAY;
loaded = true;
}
if (elapsed < SCROLL_DELAY) return;
elapsed -= SCROLL_DELAY;
const char *sync_text = "SYNC WII REMOTES AND THEN PRESS HOME";
RENDERER->clear();
x_offset--;
if (x_offset < 0-pixelArray::stringWidth(sync_text)) {
x_offset = (RENDERER->width()) + 5;
}
RENDERER->string(sync_text, x_offset, RENDERER->height()-5, color_t::purple().right(4));
for (int i=0; i<PLAYERS; i++) {
if (wii[i]->wiimoteConnected) {
char str[3] = {'P', '\0', '\0'};
str[1] = i + '1';
color_t color = pix_colorx[i+1];
color.right(3);
RENDERER->string(
str,
(i & 0x01) * 8,
(((i & 0x02) >> 1) * 6) + (RENDERER->height()-11),
color
);
}
}
}
#endif //TEENSYDUINO || ARDUINO_AVR_NANO