|
@@ -36,6 +36,7 @@ B) Increment NUMOFANIMATION by the number of animations you are going to add.
|
36
|
36
|
C) Put a function pointer to your new animation into the animations[] Array.
|
37
|
37
|
D) Implement your animation!
|
38
|
38
|
--> Get a buffer with buffNew(); Display it with setImage(); Free Buffer after usage!
|
|
39
|
+ --> Return desired duration until the next animation is called, in frames (24fps)
|
39
|
40
|
*/
|
40
|
41
|
|
41
|
42
|
// Prototypes for all animations
|
|
@@ -48,7 +49,7 @@ void zWave2(uint8_t i);
|
48
|
49
|
|
49
|
50
|
// Array of animation functions
|
50
|
51
|
#define NUMOFANIMATIONS 0
|
51
|
|
-void (*animations[NUMOFANIMATIONS])(void) = { };
|
|
52
|
+uint8_t (*animations[NUMOFANIMATIONS])(void) = { };
|
52
|
53
|
|
53
|
54
|
#define WAVELENGTH 2
|
54
|
55
|
|
|
@@ -56,7 +57,7 @@ uint8_t numOfAnimations(void) {
|
56
|
57
|
return NUMOFANIMATIONS + 24;
|
57
|
58
|
}
|
58
|
59
|
|
59
|
|
-void executeAnimation(uint8_t id) {
|
|
60
|
+uint8_t executeAnimation(uint8_t id) {
|
60
|
61
|
if (id < (6*4)) {
|
61
|
62
|
if (id < 4) {
|
62
|
63
|
upWave(id);
|
|
@@ -71,9 +72,11 @@ void executeAnimation(uint8_t id) {
|
71
|
72
|
} else {
|
72
|
73
|
zWave2(id - 20);
|
73
|
74
|
}
|
|
75
|
+ return 1;
|
74
|
76
|
} else if ((id - (6*4)) < NUMOFANIMATIONS) {
|
75
|
|
- animations[id - (6*4)](); // Call animation
|
|
77
|
+ return animations[id - (6*4)](); // Call animation
|
76
|
78
|
}
|
|
79
|
+ return 1;
|
77
|
80
|
}
|
78
|
81
|
|
79
|
82
|
void upWave(uint8_t i) {
|