|
HF-WS2812 Driver 0.1.0-dev
HF-WS2812 ESP32 RMT Driver
|
ESP-IDF RMT based driver for WS2812 / NeoPixel LED chains. More...
#include "driver/gpio.h"#include "driver/rmt_tx.h"#include "driver/rmt_types.h"#include "esp_err.h"#include "led_strip_encoder.h"#include "sdkconfig.h"#include <stdint.h>Go to the source code of this file.
Classes | |
| struct | led_state |
| Desired colors for a chain of LEDs. More... | |
Macros | |
Driver constants | |
| #define | NUM_LEDS CONFIG_WS2812_NUM_LEDS |
| #define | WS2812_LED_BUFFER_ITEMS (NUM_LEDS * WS2812_BITS_PER_LED) |
| #define | WS2812_T0H CONFIG_WS2812_T0H |
| #define | WS2812_T1H CONFIG_WS2812_T1H |
| #define | WS2812_T0L CONFIG_WS2812_T0L |
| #define | WS2812_T1L CONFIG_WS2812_T1L |
| #define | WS2812_DEFAULT_BRIGHTNESS CONFIG_WS2812_DEFAULT_BRIGHTNESS |
Functions | |
| esp_err_t | ws2812_control_init (gpio_num_t gpio_num, int channel) |
| Initialise the RMT peripheral for WS2812 output. | |
| esp_err_t | ws2812_write_leds (struct led_state new_state) |
| Send LED colour data. | |
| void | ws2812_set_brightness (uint8_t brightness) |
| Set global brightness for subsequent transmissions. | |
ESP-IDF RMT based driver for WS2812 / NeoPixel LED chains.
| #define NUM_LEDS CONFIG_WS2812_NUM_LEDS |
Number of LEDs that will be driven by the component.
| #define WS2812_DEFAULT_BRIGHTNESS CONFIG_WS2812_DEFAULT_BRIGHTNESS |
Default global brightness scaling
| #define WS2812_LED_BUFFER_ITEMS (NUM_LEDS * WS2812_BITS_PER_LED) |
Number of RMT items required to represent the LED chain.
| #define WS2812_T0H CONFIG_WS2812_T0H |
Timing for a '0' bit high pulse in RMT ticks
| #define WS2812_T0L CONFIG_WS2812_T0L |
Low time for any bit in RMT ticks
| #define WS2812_T1H CONFIG_WS2812_T1H |
Timing for a '1' bit high pulse in RMT ticks
| #define WS2812_T1L CONFIG_WS2812_T1L |
| esp_err_t ws2812_control_init | ( | gpio_num_t | gpio_num, |
| int | channel ) |
Initialise the RMT peripheral for WS2812 output.
This function must be called once before any LED data is transmitted. The GPIO and channel can be specified at runtime.
| gpio_num | GPIO connected to the LED strip. |
| channel | RMT channel to use. |
Initialise the RMT peripheral for WS2812 output.
Must be called once before any LED data is transmitted. The pin and channel can be chosen at runtime.
| gpio_num | GPIO connected to the LED strip. |
| channel | RMT channel used for transmission. |
| void ws2812_set_brightness | ( | uint8_t | brightness | ) |
Set global brightness for subsequent transmissions.
All LED values are scaled by this factor before being sent. 255 means full brightness.
| brightness | Brightness level 0-255. |
| esp_err_t ws2812_write_leds | ( | struct led_state | new_state | ) |
Send LED colour data.
The function blocks the calling task until the complete buffer has been transmitted by the RMT peripheral.
| new_state | Desired LED colours. |
Send LED colour data.
The function blocks until the RMT peripheral finishes sending all LED data.
| new_state | Desired LED colours. |