← Back to ratslair.com
aboutsummaryrefslogtreecommitdiff
path: root/include/rgb_led.h
diff options
context:
space:
mode:
authorEdvin <[email protected]>2025-09-23 16:25:37 +0200
committerEdvin <[email protected]>2025-09-23 16:25:37 +0200
commitee756f7e231300cdf8e110441e0699a8de1abdfa (patch)
tree156020048073e38f98394f31abb0549c4db52c4f /include/rgb_led.h
First commit
Diffstat (limited to 'include/rgb_led.h')
-rw-r--r--include/rgb_led.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/rgb_led.h b/include/rgb_led.h
new file mode 100644
index 0000000..66eaddc
--- /dev/null
+++ b/include/rgb_led.h
@@ -0,0 +1,25 @@
+typedef struct {
+ bool R;
+ bool G;
+ bool B;
+} rgb_color;
+
+#define rgb_white (rgb_color){ .R = 0, .G = 0, .B = 0 }
+#define rgb_yellow (rgb_color){ .R = 0, .G = 0, .B = 1 }
+#define rgb_purple (rgb_color){ .R = 0, .G = 1, .B = 0 }
+#define rgb_red (rgb_color){ .R = 0, .G = 1, .B = 1 }
+#define rgb_cyan (rgb_color){ .R = 1, .G = 0, .B = 0 }
+#define rgb_green (rgb_color){ .R = 1, .G = 0, .B = 1 }
+#define rgb_blue (rgb_color){ .R = 1, .G = 1, .B = 0 }
+#define rgb_black (rgb_color){ .R = 1, .G = 1, .B = 1 }
+
+typedef struct {
+ rgb_color color;
+ int R_pin;
+ int G_pin;
+ int B_pin;
+} rgb_led;
+
+void rgb_init_LED(rgb_led *LED, int R_pin, int G_pin, int B_pin);
+
+void rgb_set_color(rgb_led *LED, rgb_color color);