aboutsummaryrefslogtreecommitdiff
path: root/include/ws2812b.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2025-09-30 13:06:16 -0600
committerJosh Rahm <joshuarahm@gmail.com>2025-09-30 13:06:16 -0600
commit290d784950b6248782b049cd9831bd6e034fd538 (patch)
treec231c02e92ed83a02b234a85b3c07bcc5e44b168 /include/ws2812b.h
parentf89f75b5616de99865448f41b068a2783cd3648e (diff)
downloadch573-290d784950b6248782b049cd9831bd6e034fd538.tar.gz
ch573-290d784950b6248782b049cd9831bd6e034fd538.tar.bz2
ch573-290d784950b6248782b049cd9831bd6e034fd538.zip
Add a bunch. Neglected doing commits.HEADmain
Add many different patterns, and organize it. Add a voltage discovery subsystem to allow the ch573 to detect if it's on 12v or 5v lights.
Diffstat (limited to 'include/ws2812b.h')
-rw-r--r--include/ws2812b.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/ws2812b.h b/include/ws2812b.h
index 2061379..6f8aff0 100644
--- a/include/ws2812b.h
+++ b/include/ws2812b.h
@@ -45,11 +45,23 @@ typedef struct {
uint8_t r;
uint8_t g;
uint8_t b;
+
+ /* Color alpha. 0 is perfectly opaque, 255 is perfectly transparent). */
+ uint8_t a;
};
uint32_t color;
};
} rgb_t;
+typedef struct {
+ uint8_t mat[4][4];
+} rgb_mat_t;
+
+/** Returns the new RGB as if rgb1 was overlayed on top of rgb2. */
+rgb_t blend(rgb_t rgb1, rgb_t rgb2);
+
+rgb_t mat_mul(rgb_t rgb, const rgb_mat_t* mat);
+
int write_rgb(struct ws2812b_buf* out, rgb_t color);
void start_dma(struct ws2812b_buf* buf);