-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutshine.ino
57 lines (43 loc) · 1.03 KB
/
outshine.ino
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
#include "config.h"
#include "src/core/animation.h"
#include "src/core/conn.h"
#include "src/core/driver.h"
#include "src/anim/mapping.h"
// Select required interface libraries
AnimState state = {
0x21, // fade wipe animation
0x00, // start at LED 0
LED_COUNT,
0, // 0 cycles elapsed
0, // 0 frames elapsed
0x00FF0000, // red
};
ConnState conn = {
false, // no transaction
0xFF, // no animation selected
{0}, // no colors selected
0x00, // no colors selected
0x00, // no color draft
};
uint32_t framebuffer[LED_COUNT] = { 0 };
void setup() {
initMapping();
initStrip();
initPeripherals(&state, &conn);
}
void loop() {
handlePeripherals(&state, &conn);
state.led_index += 1;
if (state.led_index >= state.led_count) {
state.led_index = 0;
state.cycles_count += 1;
}
state.frame_count += 1;
void (*animation)(uint32_t[], AnimState*) = animations[state.animation];
if (animation == nullptr) {
animation = tickOff;
}
animation(framebuffer, &state);
blit(framebuffer);
delay(20);
}