aboutsummaryrefslogtreecommitdiff
path: root/include/param.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2025-12-07 16:59:51 -0700
committerJosh Rahm <joshuarahm@gmail.com>2025-12-07 16:59:51 -0700
commita4930f91ced80d26758fae30f3e01eee7abe4345 (patch)
tree7814e178c3a13b7f3bbc03dd5ad4d97af744baf8 /include/param.h
parent44c7f7a675d2cdb0281322f38be3227ef4fb1df2 (diff)
downloadesp32-ws2812b-a4930f91ced80d26758fae30f3e01eee7abe4345.tar.gz
esp32-ws2812b-a4930f91ced80d26758fae30f3e01eee7abe4345.tar.bz2
esp32-ws2812b-a4930f91ced80d26758fae30f3e01eee7abe4345.zip
Add a couple different parameter types.
fraction_t: semantically represents a value 0.0-1.0. Internally this is represented as a uint8 with 255 being 1 and 0 being 0. ratio_t: represents a fracitonal number that can be larger than 1.0.
Diffstat (limited to 'include/param.h')
-rw-r--r--include/param.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/param.h b/include/param.h
index 5259e0a..d0b5bf0 100644
--- a/include/param.h
+++ b/include/param.h
@@ -6,6 +6,8 @@
typedef struct httpd_req httpd_req_t;
typedef uint32_t color_int_t;
+typedef uint8_t fraction_t;
+typedef uint16_t ratio_t;
#define DECL_PARAMETER_INSTANCE(ty) \
void handle_option__##ty(const char* attr, sockbuf_t* sockbuf, ty* ptr); \
@@ -24,5 +26,7 @@ DECL_PARAMETER_INSTANCE(uint8_t);
DECL_PARAMETER_INSTANCE(bool);
DECL_PARAMETER_INSTANCE(uint32_t);
DECL_PARAMETER_INSTANCE(color_int_t);
+DECL_PARAMETER_INSTANCE(fraction_t);
+DECL_PARAMETER_INSTANCE(ratio_t);
DECL_PARAMETER_INSTANCE(int);
DECL_PARAMETER_INSTANCE(int32_t);