blob: 09d62339fe2dbd8d69c46287ec9cd020c188faee (
plain)
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
|
#include "libleds.h"
static struct led_obj const PANEL = {0, 1<<7, 32, 8};
void write_all(struct led_color const color)
{
led_write_rgb_all(PANEL, color);
led_latch();
}
void led_main()
{
static int const STEP = 0x04;
static int const MIN = 0x10;
static int const MAX = 0xF0;
struct led_color color = {MAX, MIN, MIN};
while (1) {
for (int i = MIN; i < MAX; i += STEP) {
color.red -= STEP;
color.green += STEP;
write_all(color);
}
color.red = MIN;
color.green = MAX;
for (int i = MIN; i < MAX; i += STEP) {
color.green -= STEP;
color.blue += STEP;
write_all(color);
}
color.green = MIN;
color.blue = MAX;
for (int i = MIN; i < MAX; i += STEP) {
color.blue -= STEP;
color.red += STEP;
write_all(color);
}
color.blue = MIN;
color.red = MAX;
}
}
|