/* * SPDX-License-Identifier: Apache-2.0 */ #pragma once #include // Pattern names (also the strings the web UI uses). Order matters: the index is the mode id. enum pattern_mode_t { PM_SOLID, PM_RAINBOW, PM_CHASE, PM_BREATHE, PM_BLINK, PM_PULSE, PM_TRANSITION, PM_CIRCLE, PM_COUNT, }; struct pattern_params_t { pattern_mode_t mode; uint8_t c1[3]; // main colour (ignored by rainbow and chase) uint8_t c2[3]; // background / second colour uint32_t speed_ms; // one step of the pattern, 10-10000 ms uint8_t brightness; // 0-255 }; /** @brief Start the LED strip and the pattern task. */ void patterns_start(void); /** @brief Replace the running pattern. Values are clamped to valid ranges. */ void patterns_set(const pattern_params_t &p); /** @brief Copy of the running pattern. */ pattern_params_t patterns_get(void); /** @brief Name of a mode, e.g. "rainbow". */ const char *patterns_mode_name(pattern_mode_t m); /** @brief Mode for a name, or PM_COUNT if unknown. */ pattern_mode_t patterns_mode_from_name(const char *name);