Browse Source

Debugging.

Thomas Buck 12 years ago
parent
commit
18ec89a596
5 changed files with 29456 additions and 13 deletions
  1. 4
    4
      CubeFirmware/cube.c
  2. 25
    9
      CubeFirmware/main.c
  3. 6237
    0
      Hardware/LED Cube with Rs.brd
  4. 23190
    0
      Hardware/LED Cube with Rs.sch
  5. BIN
      Hardware/Schematic.png

+ 4
- 4
CubeFirmware/cube.c View File

@@ -36,8 +36,8 @@
36 36
 #endif
37 37
 
38 38
 // Should be 41666
39
-#define FIRSTCOUNT 41666
40
-// Time one latch is active in ns, should be 63
39
+#define FIRSTCOUNT 1000
40
+// Time we wait for latch in ns, should be 63
41 41
 #define LATCHDELAY 63
42 42
 
43 43
 volatile uint8_t **imgBuffer = NULL; // imgBuffer[8][8]
@@ -55,7 +55,7 @@ void setImage(uint8_t *img) {
55 55
 		imgFlag = 0;
56 56
 		for (i = 0; i < 8; i++) {
57 57
 			for (j = 0; j < 8; j++) {
58
-				imgBuffer[i][j] = img[j + (i * 8)];
58
+				imgBuffer[i][j] = ~(img[j + (i * 8)]);
59 59
 			}
60 60
 		}
61 61
 	}
@@ -68,7 +68,7 @@ void fillBuffer(uint8_t val) {
68 68
 		imgFlag = 0;
69 69
 		for (i = 0; i < 8; i++) {
70 70
 			for (j = 0; j < 8; j++) {
71
-				imgBuffer[i][j] = val;
71
+				imgBuffer[i][j] = ~(val);
72 72
 			}
73 73
 		}
74 74
 	}

+ 25
- 9
CubeFirmware/main.c View File

@@ -78,14 +78,14 @@ uint8_t refreshAnimationCount = 1;
78 78
 uint8_t lastButtonState = 0;
79 79
 char buffer[11];
80 80
 
81
-uint8_t defaultImage[64] = 	{	0xe7, 0xc3, 0xa5, 0x18, 0x18, 0xa5, 0xc3, 0xe7,
82
-								0x81, 0x81, 0x00, 0x18, 0x18, 0x00, 0x81, 0x81,
83
-								0x81, 0x00, 0x81, 0x18, 0x18, 0x81, 0x00, 0x81,
84
-								0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00,
85
-								0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00,
86
-								0x81, 0x00, 0x81, 0x18, 0x18, 0x81, 0x00, 0x81,
87
-								0x81, 0x81, 0x00, 0x18, 0x18, 0x00, 0x81, 0x81,
88
-								0xe7, 0xc3, 0xa5, 0x18, 0x18, 0xa5, 0xc3, 0xe7 };
81
+uint8_t defaultImage[64] = 	{	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
82
+								0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
83
+								0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
84
+								0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
85
+								0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
86
+								0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
87
+								0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
88
+								0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
89 89
 
90 90
 int main(void) {
91 91
 	uint8_t *audioData = NULL;
@@ -238,13 +238,15 @@ void serialHandler(char c) {
238 238
 		serialWrite(OK);
239 239
 		break;
240 240
 
241
-	case 'h': case 'H':
241
+	case 'h': case 'H': case '?':
242 242
 		serialWriteString("(d)elete, (g)et anims, (s)et anims, (v)ersion\n");
243 243
 #ifdef DEBUG
244 244
 		serialWriteString("(t)ime, (a)udio, (c)ount, (x)Custom count\n");
245 245
 		serialWriteString("(y)Set fixed animation count\n");
246 246
 		serialWriteString("S(e)lf Test\n");
247 247
 		serialWriteString("Play S(n)ake\n");
248
+		serialWriteString("(0): All LEDs Off\n");
249
+		serialWriteString("(1): All LEDs On\n");
248 250
 #endif
249 251
 		break;
250 252
 
@@ -323,6 +325,20 @@ void serialHandler(char c) {
323 325
 	case 'n': case 'N':
324 326
 		snake();
325 327
 		break;
328
+
329
+	case '0':
330
+		fillBuffer(0x00);
331
+		setAnimationCount(0);
332
+		refreshAnimationCount = 1;
333
+		serialWriteString("Killed Animation Counter!\n");
334
+		break;
335
+
336
+	case '1':
337
+		fillBuffer(0xFF);
338
+		setAnimationCount(0);
339
+		refreshAnimationCount = 1;
340
+		serialWriteString("Killed Animation Counter!\n");
341
+		break;
326 342
 #endif
327 343
 
328 344
 	default:

+ 6237
- 0
Hardware/LED Cube with Rs.brd
File diff suppressed because it is too large
View File


+ 23190
- 0
Hardware/LED Cube with Rs.sch
File diff suppressed because it is too large
View File


BIN
Hardware/Schematic.png View File


Loading…
Cancel
Save