ESP32 Native version of Blinky, featureful controller code for WS2811/WS2812/NeoPixels
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

26 Zeilen
517B

  1. #pragma once
  2. #include <driver/spi_master.h>
  3. #include "leds.hpp"
  4. class SPI_LEDs : public LEDStrip {
  5. public:
  6. SPI_LEDs(int gpio, int length = 0);
  7. void show();
  8. void length_changing(int len) { configure(len); }
  9. private:
  10. spi_host_device_t host;
  11. int gpio;
  12. spi_device_handle_t device;
  13. uint8_t *out_buf;
  14. spi_transaction_t transaction;
  15. static constexpr int reset_bytes = 30;
  16. static size_t tx_len(int len) { return (len * 3) * 4 + reset_bytes; }
  17. void configure(int length);
  18. };