aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2025-12-07 00:36:35 -0700
committerJosh Rahm <joshuarahm@gmail.com>2025-12-07 00:36:35 -0700
commit8c6fd7fd39a17216b1a12601a1ec943d557040c2 (patch)
tree24d3b5cd1d92e7ec2ef6e4ab6e798f0eaa490b53 /include
parent717506bcd31fbf7093876297cca9cfea0bc4dc08 (diff)
downloadesp32-ws2812b-8c6fd7fd39a17216b1a12601a1ec943d557040c2.tar.gz
esp32-ws2812b-8c6fd7fd39a17216b1a12601a1ec943d557040c2.tar.bz2
esp32-ws2812b-8c6fd7fd39a17216b1a12601a1ec943d557040c2.zip
Add twinkle and a few more params and make the display less janky and
more robust.
Diffstat (limited to 'include')
-rw-r--r--include/pattern/twinkle.h6
-rw-r--r--include/state_params.i4
-rw-r--r--include/ws2812b_writer.h13
3 files changed, 19 insertions, 4 deletions
diff --git a/include/pattern/twinkle.h b/include/pattern/twinkle.h
new file mode 100644
index 0000000..3dfe85f
--- /dev/null
+++ b/include/pattern/twinkle.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdlib.h>
+
+uint8_t twinkle(uint32_t time, size_t x, uint8_t);
diff --git a/include/state_params.i b/include/state_params.i
index 15a5b43..875328d 100644
--- a/include/state_params.i
+++ b/include/state_params.i
@@ -10,3 +10,7 @@ STATE_PARAM(int, x_scale, "X Scale", 255)
STATE_PARAM(bool, power, "Power", true)
STATE_PARAM(bool, cool, "Cool", false)
STATE_PARAM(bool, invert, "Invert", false)
+STATE_PARAM(bool, use_static_color, "Use Static Color", false)
+STATE_PARAM(color_int_t, static_color, "Static Color", 0xffddbb)
+STATE_PARAM(bool, twinkle, "Twinkle", true)
+STATE_PARAM(uint8_t, twink_amt, "Twinkle Amount", 0)
diff --git a/include/ws2812b_writer.h b/include/ws2812b_writer.h
index e8fa84f..ac4eb05 100644
--- a/include/ws2812b_writer.h
+++ b/include/ws2812b_writer.h
@@ -4,18 +4,23 @@
#include "drv/ws2812b.h"
#include "freertos/FreeRTOS.h"
+#include "freertos/semphr.h"
#include "freertos/task.h"
extern const int NUMBER_PARAMS;
-typedef struct {
- ws2812b_t* drv;
+typedef uint32_t color_int_t;
- struct {
+typedef struct {
#define STATE_PARAM(t, n, ...) t n;
#include "state_params.i"
#undef STATE_PARAM
- } state;
+} ws_state_t;
+
+typedef struct {
+ ws2812b_t* drv;
+ ws_state_t state;
+ SemaphoreHandle_t state_lock;
} ws_params_t;
void reset_parameters(ws_params_t* params);