|
@@ -56,7 +56,7 @@
|
56
|
56
|
#define ISERROR(x, e) ((x) & (e))
|
57
|
57
|
|
58
|
58
|
// Length of an idle animation frame, 24 -> 1 second
|
59
|
|
-#define IDLELENGTH 24
|
|
59
|
+#define IDLELENGTH 48
|
60
|
60
|
|
61
|
61
|
void serialHandler(char c);
|
62
|
62
|
void sendAudioData(void);
|
|
@@ -107,6 +107,15 @@ uint8_t defaultImageC[64] = { 0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
|
107
|
107
|
0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
|
108
|
108
|
0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02 };
|
109
|
109
|
|
|
110
|
+uint8_t defaultImageCube[64] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
111
|
+ 0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
|
|
112
|
+ 0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
|
|
113
|
+ 0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
|
|
114
|
+ 0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
|
|
115
|
+ 0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
|
|
116
|
+ 0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
|
|
117
|
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
|
118
|
+
|
110
|
119
|
#define IDLEANIMATIONCOUNT 3
|
111
|
120
|
uint8_t *idleAnimation[IDLEANIMATIONCOUNT] = { defaultImageA, defaultImageB, defaultImageC };
|
112
|
121
|
|
|
@@ -128,21 +137,23 @@ int main(void) {
|
128
|
137
|
MCUCSR = 0;
|
129
|
138
|
wdt_disable();
|
130
|
139
|
|
|
140
|
+ DDRA = 0xFF; // Latch Data Bus as Output
|
|
141
|
+ DDRD = 0xFC; DDRB = 24; // Mosfets as Output
|
|
142
|
+ DDRC = 0xFC; DDRB |= 6; // Latch Enable as Output
|
|
143
|
+ DDRB &= ~(1 << PB0); // Pushbutton as Input
|
|
144
|
+
|
131
|
145
|
initCube();
|
132
|
146
|
serialInit(25, 8, NONE, 1);
|
133
|
147
|
i2c_init();
|
134
|
148
|
initSystemTimer();
|
135
|
149
|
sei(); // Enable Interrupts
|
136
|
150
|
|
|
151
|
+#ifndef DEBUG
|
137
|
152
|
// wdt_enable(WDTO_500MS); // Enable watchdog reset after 500ms
|
138
|
153
|
wdt_enable(WDTO_1S); // Watchdog reset after 1 second
|
|
154
|
+#endif
|
139
|
155
|
|
140
|
|
- DDRA = 0xFF; // Latch Data Bus as Output
|
141
|
|
- DDRD = 0xFC; DDRB = 24; // Mosfets as Output
|
142
|
|
- DDRC = 0xFC; DDRB |= 6; // Latch Enable as Output
|
143
|
|
- DDRB &= ~(1 << PB0); // Pushbutton as Input
|
144
|
|
-
|
145
|
|
- setImage(defaultImageA); // Display something
|
|
156
|
+ setImage(defaultImageCube); // Display something
|
146
|
157
|
|
147
|
158
|
#ifdef DEBUG
|
148
|
159
|
// Kill animation counter in debug mode
|
|
@@ -344,7 +355,7 @@ void randomAnimation(void) {
|
344
|
355
|
|
345
|
356
|
void serialHandler(char c) {
|
346
|
357
|
// Used letters:
|
347
|
|
- // a, c, d, e, g, i, n, q, r, s, t, v, x, y, 0, 1, 2
|
|
358
|
+ // a, c, d, e, g, i, n, q, r, s, t, v, x, y, 0, 1, 2, 3
|
348
|
359
|
#ifdef DEBUG
|
349
|
360
|
uint8_t i, y, z;
|
350
|
361
|
serialWrite(c);
|
|
@@ -459,6 +470,11 @@ void serialHandler(char c) {
|
459
|
470
|
DebugDone |= 4;
|
460
|
471
|
break;
|
461
|
472
|
|
|
473
|
+ case '3':
|
|
474
|
+ setImage(defaultImageCube);
|
|
475
|
+ DebugDone |= 4;
|
|
476
|
+ break;
|
|
477
|
+
|
462
|
478
|
case '2':
|
463
|
479
|
DebugDone |= 4;
|
464
|
480
|
fillBuffer(0);
|