uploaded 4 months ago
High-performance Neopixel driver (I2S DMA, WS2812B)

readme

# ESP32 Neopixel Driver
High-performance low-level driver for WS2812B LEDs.


# Example Application

```cpp
#include <sys/fcntl.h>
#include <sys/unistd.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include "esp_log.h"
#include "driver/gpio.h"
#include "neopixel.h"
#include "helpers.h"

#define PIXEL_COUNT 44
#define NEOPIXEL_PIN GPIO_NUM_27

void app_main(void)
{
   tNeopixelContext neopixel;
   uint32_t iteration;
   uint32_t refreshRate;
   uint32_t taskDelay;

   neopixel = neopixel_Init(PIXEL_COUNT, NEOPIXEL_PIN);
   refreshRate = neopixel_GetRefreshRate(neopixel);
   ESP_LOGI(__func__, "Refresh rate: %" PRIu32, refreshRate);

   iteration = 0;
   taskDelay = MAX(1, pdMS_TO_TICKS(1000UL / refreshRate));
   for(;;)
   {
      tNeopixel pixel[] =
      {
          { (iteration)   % PIXEL_COUNT, NP_RGB(0, 0, 0) },
          { (iteration+5) % PIXEL_COUNT, NP_RGB(0, 0, 1) },
      };
      neopixel_SetPixel(neopixel, pixel, ARRAY_SIZE(pixel));
      ++iteration;
      vTaskDelay(taskDelay);
   }

   neopixel_Deinit(neopixel);
}
```

Links

Supports all targets

License: MIT

To add this component to your project, run:

idf.py add-dependency "zorxx/neopixel^1.0.0"

or download archive

Stats

  • Downloaded in total
    Downloaded in total 82 times
  • Downloaded this version
    This version: 2 times

Badge

zorxx/neopixel version: 1.0.0
|