summaryrefslogtreecommitdiff
path: root/src/app/ws2812b-test
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-11-16 18:16:39 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-11-16 18:16:39 +0100
commit044c1749ae5df2257719bcbff67eb76141e903d1 (patch)
tree74d4afefc34e0fce0c6058854fc8b8a99dfded9d /src/app/ws2812b-test
parent3c4779d3827f9c5893b0fa496fb709e9d55b5d9c (diff)
Add WS2812b test application
Diffstat (limited to 'src/app/ws2812b-test')
-rw-r--r--src/app/ws2812b-test/Kconfig6
-rw-r--r--src/app/ws2812b-test/Makefile.inc9
-rw-r--r--src/app/ws2812b-test/main.cc42
3 files changed, 57 insertions, 0 deletions
diff --git a/src/app/ws2812b-test/Kconfig b/src/app/ws2812b-test/Kconfig
new file mode 100644
index 0000000..fdc4884
--- /dev/null
+++ b/src/app/ws2812b-test/Kconfig
@@ -0,0 +1,6 @@
+# Copyright 2020 Birte Kristina Friesel
+#
+# SPDX-License-Identifier: CC0-1.0
+
+prompt "WS2812b Test"
+depends on arch_arduino_nano && meta_driver_neopixel
diff --git a/src/app/ws2812b-test/Makefile.inc b/src/app/ws2812b-test/Makefile.inc
new file mode 100644
index 0000000..d4c4fb8
--- /dev/null
+++ b/src/app/ws2812b-test/Makefile.inc
@@ -0,0 +1,9 @@
+# vim:ft=make
+#
+# Copyright 2020 Birte Kristina Friesel
+#
+# SPDX-License-Identifier: CC0-1.0
+
+ifdef app
+ override arch_drivers += ,neopixel
+endif
diff --git a/src/app/ws2812b-test/main.cc b/src/app/ws2812b-test/main.cc
new file mode 100644
index 0000000..8a4aaff
--- /dev/null
+++ b/src/app/ws2812b-test/main.cc
@@ -0,0 +1,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(0, 0, 0));
+ if (pixel == 255) {
+ pixel = 0;
+ } else {
+ pixel++;
+ }
+ np.setPixelColor(pixel, np.Color(64, 64, 64));
+ np.show();
+ _delay_ms(10);
+ }
+
+ return 0;
+}