diff options
Diffstat (limited to 'numtest.c')
| -rw-r--r-- | numtest.c | 30 |
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); +} |
