esp_ws28xx/esp_ws28xx.h

51 lines
1,009 B
C
Raw Permalink Normal View History

2023-07-16 12:06:00 +03:00
#ifndef MAIN_ESP_WS28XX_H_
#define MAIN_ESP_WS28XX_H_
2023-09-21 05:04:24 +03:00
#include "driver/gpio.h"
#include "driver/spi_master.h"
2023-09-21 13:50:26 +03:00
#include <stdio.h>
#include <string.h>
2023-07-16 12:06:00 +03:00
typedef struct {
2023-09-21 05:04:24 +03:00
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;
2023-09-21 03:04:42 +03:00
};
2023-07-16 12:06:00 +03:00
} CRGB;
typedef struct {
2023-09-21 05:04:24 +03:00
spi_host_device_t host;
spi_device_handle_t spi;
int dma_chan;
spi_device_interface_config_t devcfg;
spi_bus_config_t buscfg;
2023-07-16 12:06:00 +03:00
} spi_settings_t;
typedef enum {
2023-09-21 05:04:24 +03:00
WS2812B = 0,
WS2815,
2023-07-16 12:06:00 +03:00
} led_strip_model_t;
2023-09-21 13:50:26 +03:00
esp_err_t ws28xx_init(int pin, led_strip_model_t model, int num_of_leds,
CRGB **led_buffer_ptr);
2023-09-21 03:04:42 +03:00
void ws28xx_fill_all(CRGB color);
esp_err_t ws28xx_update();
2023-07-16 12:06:00 +03:00
#endif /* MAIN_ESP_WS28XX_H_ */