-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathesp_ws28xx.h
50 lines (42 loc) · 1009 Bytes
/
esp_ws28xx.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef MAIN_ESP_WS28XX_H_
#define MAIN_ESP_WS28XX_H_
#include "driver/gpio.h"
#include "driver/spi_master.h"
#include <stdio.h>
#include <string.h>
typedef struct {
union {
struct {
union {
uint8_t r;
uint8_t red;
};
union {
uint8_t g;
uint8_t green;
};
union {
uint8_t b;
uint8_t blue;
};
};
uint8_t raw[3];
uint32_t num;
};
} CRGB;
typedef struct {
spi_host_device_t host;
spi_device_handle_t spi;
int dma_chan;
spi_device_interface_config_t devcfg;
spi_bus_config_t buscfg;
} spi_settings_t;
typedef enum {
WS2812B = 0,
WS2815,
} led_strip_model_t;
esp_err_t ws28xx_init(int pin, led_strip_model_t model, int num_of_leds,
CRGB **led_buffer_ptr);
void ws28xx_fill_all(CRGB color);
esp_err_t ws28xx_update();
#endif /* MAIN_ESP_WS28XX_H_ */