aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-12-01 21:29:34 -0700
committerJosh Rahm <joshuarahm@gmail.com>2022-12-01 21:29:34 -0700
commit05e3f6bb7293c771629c7b3599392c8f335e7dd8 (patch)
treec2a5cd4d27d7673b3a58071c0656f87c92ee9ff3 /include
parent8d379bf60e50960f6c855cd6b9c83956a082f73d (diff)
downloadesp32-ws2812b-05e3f6bb7293c771629c7b3599392c8f335e7dd8.tar.gz
esp32-ws2812b-05e3f6bb7293c771629c7b3599392c8f335e7dd8.tar.bz2
esp32-ws2812b-05e3f6bb7293c771629c7b3599392c8f335e7dd8.zip
Add an HTTP Server.
This server allows the user to control the parameters of the state for displaying the lights.
Diffstat (limited to 'include')
-rw-r--r--include/http_server.h11
-rw-r--r--include/state_params.i21
-rw-r--r--include/ws2812b_writer.h4
3 files changed, 26 insertions, 10 deletions
diff --git a/include/http_server.h b/include/http_server.h
new file mode 100644
index 0000000..578b561
--- /dev/null
+++ b/include/http_server.h
@@ -0,0 +1,11 @@
+#pragma once
+#ifndef HTTP_SERVER_H_
+#define HTTP_SERVER_H_
+
+#include <esp_log.h>
+#include <esp_http_server.h>
+#include "ws2812b_writer.h"
+
+httpd_handle_t start_webserver(ws_params_t* params);
+
+#endif /* HTTP_SERVER_H_ */
diff --git a/include/state_params.i b/include/state_params.i
index 447b72b..15a5b43 100644
--- a/include/state_params.i
+++ b/include/state_params.i
@@ -1,9 +1,12 @@
-STATE_PARAM(uint32_t, time)
-STATE_PARAM(int, timetick)
-STATE_PARAM(uint8_t, brightness)
-STATE_PARAM(uint8_t, off)
-STATE_PARAM(uint8_t, n_snow)
-STATE_PARAM(uint8_t, n_red)
-STATE_PARAM(bool, sleep)
-STATE_PARAM(bool, power)
-STATE_PARAM(bool, cool)
+// List of parameters.
+// type name display name, default value
+
+STATE_PARAM(uint32_t, time, "Current Time", 0)
+STATE_PARAM(int, timetick, "Speed", 100)
+STATE_PARAM(uint8_t, brightness, "Brightness", 50)
+STATE_PARAM(uint8_t, n_snow, "Snow Effect", 10)
+STATE_PARAM(uint8_t, n_red, "Desaturation", 32)
+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)
diff --git a/include/ws2812b_writer.h b/include/ws2812b_writer.h
index 89b4f7a..e8fa84f 100644
--- a/include/ws2812b_writer.h
+++ b/include/ws2812b_writer.h
@@ -6,11 +6,13 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
+extern const int NUMBER_PARAMS;
+
typedef struct {
ws2812b_t* drv;
struct {
-#define STATE_PARAM(t, n) t n;
+#define STATE_PARAM(t, n, ...) t n;
#include "state_params.i"
#undef STATE_PARAM
} state;