#pragma once #include #include "leds.hpp" class SPI_LEDs : public LEDStrip { public: SPI_LEDs(int gpio, int length = 0); void show(); void length_changing(int len) { configure(len); } private: spi_host_device_t host; int gpio; spi_device_handle_t device; uint8_t *out_buf; spi_transaction_t transaction; static constexpr int reset_bytes = 30; static size_t tx_len(int len) { return (len * 3) * 4 + reset_bytes; } void configure(int length); };