summaryrefslogtreecommitdiffstats
path: root/numtest.c
diff options
context:
space:
mode:
authorTobias Wiese <tobias@tobiaswiese.com>2021-05-03 23:58:30 +0200
committerTobias Wiese <tobias@tobiaswiese.com>2021-07-22 02:26:29 +0200
commit68b5f182af145fdd9e62c9dde3eedcb9108f5ba4 (patch)
tree67c0011276b30f8f785b934be44044935f78bd73 /numtest.c
Initial commitHEADmaster
Signed-off-by: Tobias Wiese <tobias@tobiaswiese.com>
Diffstat (limited to 'numtest.c')
-rw-r--r--numtest.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/numtest.c b/numtest.c
new file mode 100644
index 0000000..50aeca4
--- /dev/null
+++ b/numtest.c
@@ -0,0 +1,30 @@
+#include <util/delay.h>
+#include <string.h>
+#include <stdlib.h>
+#include "libleds.h"
+#include "chars/chars.h"
+
+static struct led_obj const PANEL = {0, 1<<7, 32, 8};
+
+void led_main()
+{
+ // clear
+ struct led_color const clear_color = { 0, 0, 0 };
+ led_write_rgb_all(PANEL, clear_color);
+
+ const struct led_color active_color = {0x10, 0x10, 0x10};
+ const char *text = "0123";
+ struct led_color *buf = leds_text(active_color, text);
+
+ if (buf == NULL) {
+ return;
+ }
+
+ struct led_color const padding = { 0, 0, 0 };
+ for (unsigned int i = 0; i < 4*char_height; i++)
+ led_write_rgb(PANEL.port, PANEL.pins, padding);
+ for (unsigned int i = 0; i < char_length * strlen(text); i++)
+ led_write_rgb(PANEL.port, PANEL.pins, buf[i]);
+
+ free(buf);
+}