Generate the web UI headers from c/web/ via scripts/embed_file.py (minify + gzip) and serve them with Content-Encoding, replacing the checked-in web_*.h blobs. Move the LED driver/presets into lib/leds, and parse preset edits into a typed cmd_preset_t on core0 instead of passing raw JSON to core1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
771 B
C++
35 lines
771 B
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <vector>
|
|
#include "hardware/dma.h"
|
|
#include "hardware/pio.h"
|
|
|
|
struct RGB;
|
|
|
|
class WS2812B {
|
|
public:
|
|
WS2812B(uint16_t num_leds, uint pin, uint strip_index, float brightness = 1.0f);
|
|
~WS2812B();
|
|
WS2812B(const WS2812B&) = delete;
|
|
WS2812B& operator=(const WS2812B&) = delete;
|
|
|
|
void fill(RGB color);
|
|
void set(uint16_t index, RGB color);
|
|
void show(const uint8_t* buffer = nullptr, size_t offset = 0);
|
|
void prepare_show(const uint8_t* buffer = nullptr, size_t offset = 0);
|
|
void trigger();
|
|
bool busy() const;
|
|
|
|
uint16_t num_leds;
|
|
float brightness;
|
|
std::vector<uint8_t> buffer;
|
|
int dma_channel = -1;
|
|
PIO pio = pio0;
|
|
uint sm = 0;
|
|
|
|
private:
|
|
uint pin_;
|
|
};
|