diff options
| author | Tobias Wiese <tobias@tobiaswiese.com> | 2021-05-03 23:58:30 +0200 |
|---|---|---|
| committer | Tobias Wiese <tobias@tobiaswiese.com> | 2021-07-22 02:26:29 +0200 |
| commit | 68b5f182af145fdd9e62c9dde3eedcb9108f5ba4 (patch) | |
| tree | 67c0011276b30f8f785b934be44044935f78bd73 /fade.c | |
Signed-off-by: Tobias Wiese <tobias@tobiaswiese.com>
Diffstat (limited to 'fade.c')
| -rw-r--r-- | fade.c | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -0,0 +1,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; + } +} |
