From 05e3f6bb7293c771629c7b3599392c8f335e7dd8 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Thu, 1 Dec 2022 21:29:34 -0700 Subject: Add an HTTP Server. This server allows the user to control the parameters of the state for displaying the lights. --- include/http_server.h | 11 +++++++++++ include/state_params.i | 21 ++++++++++++--------- include/ws2812b_writer.h | 4 +++- 3 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 include/http_server.h (limited to 'include') 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 +#include +#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; -- cgit