From 68b5f182af145fdd9e62c9dde3eedcb9108f5ba4 Mon Sep 17 00:00:00 2001 From: Tobias Wiese Date: Mon, 3 May 2021 23:58:30 +0200 Subject: Initial commit Signed-off-by: Tobias Wiese --- numtest.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 numtest.c (limited to 'numtest.c') 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 +#include +#include +#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); +} -- cgit v1.2.3