forked from JSchaenzle/ESP32-NeoPixel-WS2812-RMT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathws2812_control.h
33 lines (25 loc) · 850 Bytes
/
ws2812_control.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef WS2812_CONTROL_H
#define WS2812_CONTROL_H
#include <stdint.h>
#include "sdkconfig.h"
#include "esp_err.h"
#define NUM_LEDS CONFIG_WS2812_NUM_LEDS
#ifdef __cplusplus
extern "C" {
#endif
// This structure is used for indicating what the colors of each LED should be set to.
// There is a 32bit value for each LED. Only the lower 3 bytes are used and they hold the
// Red (byte 2), Green (byte 1), and Blue (byte 0) values to be set.
struct led_state {
uint32_t leds[NUM_LEDS];
};
// Setup the hardware peripheral. Only call this once.
esp_err_t ws2812_control_init(void);
// Update the LEDs to the new state. Call as needed.
// This function will block the current task until the RMT peripheral is finished sending
// the entire sequence.
esp_err_t ws2812_write_leds(struct led_state new_state);
#endif
#ifdef __cplusplus
}
#endif