ESP32 Native version of Blinky, featureful controller code for WS2811/WS2812/NeoPixels
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

26 行
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. };