audio-reactive-led-strip/arduino/ws2812_controller/ws2812_i2s.h
Scott Lawson f860922d67 Removed ws2812b i2s library dependency, updated README
I have added a pre-configured version of the ws2812b i2s library to the
Arduino code. This removes the need to download and install the ws2812b
i2s library manually. The ws2812b code has been preconfigured to reduce
the temporal compared to the default value. The default value was found
to cause excessive flickering. The readme has been updated to reflect
this change. Also added a note about the maximum number of LEDs (255)
2016-12-30 22:31:27 -07:00

42 lines
686 B
C++

// ws2812_lib.h
#ifndef __WS2812_I2S_H__
#define __WS2812_I2S_H__
#include <stdint.h>
#include "ws2812_defs.h"
// include C-style header
extern "C"
{
#include "ws2812_dma.h"
};
typedef struct
{
uint8_t G; // G,R,B order is determined by WS2812B
uint8_t R;
uint8_t B;
} Pixel_t;
class WS2812
{
public:
WS2812(void);
~WS2812(void);
void init(uint16_t num_leds);
void show(Pixel_t *);
private:
uint16_t num_leds;
uint32_t *i2s_pixels_buffer[WS2812_DITHER_NUM];
uint32_t i2s_zeros_buffer[NUM_I2S_ZERO_WORDS];
sdio_queue_t i2s_zeros_queue[WS2812_DITHER_NUM];
sdio_queue_t i2s_pixels_queue[WS2812_DITHER_NUM];
};
#endif
// end of file