summaryrefslogtreecommitdiff
path: root/src/app/ws2812b-test/main.cc
blob: 8a8926b97a9a980f83ca16f6ceb7562d47e03242 (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
42
/*
 * Copyright 2020 Birte Kristina Friesel
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */
#include "arch.h"
#include "driver/neopixel.h"
#include "driver/stdin.h"
#include "driver/stdout.h"
#include <util/delay.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>

#define NUM_PIXELS 256

Adafruit_NeoPixel np(NUM_PIXELS, GPIO::pc0, NEO_GRB+NEO_KHZ800);

int main(void)
{
	arch.setup();
	gpio.setup();
	kout.setup();
	np.setup();

	unsigned char pixel = 0;

	while (1) {
		gpio.led_toggle();
		np.setPixelColor(pixel, np.Color(1, 1, 1));
		if (pixel == 255) {
			pixel = 0;
		} else {
			pixel++;
		}
		np.setPixelColor(pixel, np.Color(64, 64, 64));
		np.show();
		_delay_ms(10);
	}

	return 0;
}