#ifndef _WS2812_H #define _WS2812_H #define WSGPIO 0 #include "c_types.h" #include "user_interface.h" #include "ets_sys.h" #include "gpio.h" #include "ets_sys.h" #include "osapi.h" #include "math.h" #include "log/esp_log.h" /*------------------------------------------------------------------------------*/ // Configuration Parameters /*------------------------------------------------------------------------------*/ #define WS2811_COMPATIBLE 0 // set to make driver backwards compatable. #define WS2812_REFRESH_INTERVAL 60 // timer to update WS2812 #define WS2812_RED_INDEX 1 #define WS2812_GREEN_INDEX 0 #define WS2812_BLUE_INDEX 2 typedef enum { WS2812_OFF = 0, WS2812_RED, WS2812_BLUE, WS2812_GREEN, WS2812_MAGENTA, WS2812_ORANGE } WS2812_COLOR_et; typedef enum { WS2812_SOLID = 0, WS2812_PULSE } WS2812_PATTERN_et; typedef enum { WS2812_UP = 0, WS2812_DOWN } WS2812_DIRECTION_et; typedef struct { WS2812_COLOR_et color; WS2812_PATTERN_et pattern; uint8_t color_mask[3]; uint32_t led_state; WS2812_DIRECTION_et direction; } WS2812_CONFIG_t; /*------------------------------------------------------------------------------*/ //You will have to os_intr_lock(); os_intr_unlock(); /* NOTE: The first byte stored is the last byte sent. 50us is required for sent data to latch to all LEDS Data is stored in the following format: [ byte1: green, byte2: red, byte3: blue] NOTE: Every function except ws2812_outBuffer is stored in Flash. */ /*------------------------------------------------------------------------------*/ // Function Prototypes /*------------------------------------------------------------------------------*/ void WS2812_OutBuffer(int8_t * buffer, uint16_t length); void WS2812_SetColor(WS2812_COLOR_et color, WS2812_PATTERN_et pattern); // void ws2812_green(void); // void ws2812_red(void); // void ws2812_blue(void); // void ws2812_clear(void); /*------------------------------------------------------------------------------*/ #endif