ESP32 Native version of Blinky, featureful controller code for WS2811/WS2812/NeoPixels
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
555B

  1. #pragma once
  2. #include <freertos/queue.h>
  3. #include <driver/rmt_tx.h>
  4. #include "leds.hpp"
  5. struct ws2811_rmt_encoder : rmt_encoder_t {
  6. rmt_encoder_t *bytes_encoder;
  7. rmt_encoder_t *reset_encoder;
  8. bool bytes_encoded;
  9. };
  10. class RMT_LEDs : public LEDStrip {
  11. public:
  12. RMT_LEDs(int gpio, int length = 0);
  13. ~RMT_LEDs();
  14. void show();
  15. void length_changing(int len) { configure(len); }
  16. private:
  17. int gpio;
  18. rmt_channel_handle_t channel;
  19. ws2811_rmt_encoder encoder;
  20. QueueHandle_t queue;
  21. void configure(int length);
  22. };