summaryrefslogtreecommitdiffstats
path: root/libleds.h
diff options
context:
space:
mode:
Diffstat (limited to 'libleds.h')
-rw-r--r--libleds.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/libleds.h b/libleds.h
new file mode 100644
index 0000000..2af1325
--- /dev/null
+++ b/libleds.h
@@ -0,0 +1,55 @@
+#ifndef LIBLEDS_H
+#define LIBLEDS_H
+#include <stdio.h>
+
+struct led_color {
+ unsigned char red;
+ unsigned char green;
+ unsigned char blue;
+};
+
+struct led_obj {
+ /*
+ * port to use as output.
+ *
+ * The port must already be configured for output.
+ *
+ * currently this is not used and PORTD is used instead.
+ */
+ uint16_t port;
+
+ /*
+ * bitmask specifing with ports to use.
+ *
+ * currently this is not used and 0xFF is used instead.
+ */
+ unsigned char pins;
+
+ /*
+ * the width of the object.
+ *
+ * Might be 0 if the width is unknown. Some function that depend on
+ * knowing the number of elements will not work.
+ */
+ unsigned int width;
+
+ /*
+ * the height of the object.
+ *
+ * Might be 0 if the height is unknown. Some function that depend on
+ * knowing the number of elements will not work.
+ *
+ * If the object is not a rectangle this should be set to 1.
+ * width is then the number of leds in the strip / star / ...
+ */
+ unsigned int height;
+};
+
+void led_write_rgb(uint16_t const port, unsigned char const pins,
+ struct led_color color);
+
+void led_write_rgb_all(struct led_obj const obj, struct led_color const color);
+
+void led_latch();
+
+#endif /* !LIBLEDS_H */