Bläddra i källkod

Started hardcoding an animation

Max Nuding 12 år sedan
förälder
incheckning
e055f31a23
2 ändrade filer med 38 tillägg och 1 borttagningar
  1. 37
    1
      CubeFirmware/animations.c
  2. 1
    0
      CubeFirmware/main.c

+ 37
- 1
CubeFirmware/animations.c Visa fil

@@ -52,5 +52,41 @@ void simpleAnimation(void) {
52 52
 }
53 53
 
54 54
 void anotherAnimation(void) {
55
+	uint8_t *buff;
56
+	int8_t x, y, z;
57
+	
58
+	buff = buffNew();
55 59
 
56
-}
60
+	//Up-wave (Frames 1-8 of showoff.cube)
61
+	//We still need to set the Time, I haven't done that yet.
62
+	for(y = 0; y < 8; y++) {
63
+		for(x = 0; x < 8; x++) {
64
+			for(z = 0; z < 8; z++) {
65
+				buffSetPixel(buff, x, y, z);
66
+			}
67
+		}
68
+		setImage(buff);
69
+	
70
+		for(x = 0; x < 8; x++) {
71
+			for(z = 0; z < 8; z++) {
72
+				buffClearPixel(buff, x, y, z);
73
+			}
74
+		}
75
+	}
76
+	
77
+	//Down-wave (Frames 9-15 of showoff.cube)
78
+	for(y = 7; y >= 0; y--) {
79
+		for(x = 0; x < 8; x++) {
80
+			for(z = 0; z < 8; z++) {
81
+				buffSetPixel(buff, x, y, z);
82
+			}
83
+		}
84
+		setImage(buff);
85
+	
86
+		for(x = 0; x < 8; x++) {
87
+			for(z = 0; z < 8; z++) {
88
+				buffClearPixel(buff, x, y, z);
89
+			}
90
+		}
91
+	}		
92
+}

+ 1
- 0
CubeFirmware/main.c Visa fil

@@ -190,6 +190,7 @@ int main(void) {
190 190
 					free(imageData);
191 191
 				}
192 192
 			} else { // No frames available
193
+				executeAnimation(1); //Uhm.... I'm sure this belongs here ;)
193 194
 				if (!(DebugDone & 4)) { // Idle animation allowed
194 195
 					if (DebugDone & 2) {
195 196
 						if (idleCounter < numOfAnimations()) {

Laddar…
Avbryt
Spara