aboutsummaryrefslogtreecommitdiff
path: root/include/drv/ws2812b.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2021-11-29 18:03:00 -0700
committerJosh Rahm <joshuarahm@gmail.com>2021-11-29 18:03:00 -0700
commit80d6050ab3fe42f8850bf166c33eb3c9150a252b (patch)
treebd4f501468626bbc14867544ed3a66bf725b60e8 /include/drv/ws2812b.h
parentc6a0cf2ff3403e9726ea6429af50bedcfd4f9a01 (diff)
downloadesp32-ws2812b-80d6050ab3fe42f8850bf166c33eb3c9150a252b.tar.gz
esp32-ws2812b-80d6050ab3fe42f8850bf166c33eb3c9150a252b.tar.bz2
esp32-ws2812b-80d6050ab3fe42f8850bf166c33eb3c9150a252b.zip
Add limited ability to control LEDs remotely.
Diffstat (limited to 'include/drv/ws2812b.h')
-rw-r--r--include/drv/ws2812b.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/drv/ws2812b.h b/include/drv/ws2812b.h
index b14b31a..39f2794 100644
--- a/include/drv/ws2812b.h
+++ b/include/drv/ws2812b.h
@@ -40,4 +40,14 @@ static inline void ws2812b_buffer_set_rgb(
buf->rgb[idx].b = b;
}
+static inline void ws2812b_buffer_set_color(
+ ws2812b_buffer_t* buf, size_t idx, ws2812b_rgb_t* color)
+{
+ if (idx >= buf->n_rgb) {
+ return;
+ }
+
+ buf->rgb[idx] = *color;
+}
+
#endif /* INCLUDE_DRV_WS2812B_H_ */