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
|
#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);
}
|