You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
540 B

#pragma once
#include "periph/spi.h"
typedef struct {
spi_t spi;
} ws2812_t;
typedef struct __attribute__((packed)) {
char b;
char r;
char g;
} ws2812_rgb_t;
#define BLUE {0x00, 0x00, 0xFF}
#define RED {0x00, 0xFF, 0x00}
#define GREEN {0xFF, 0x00, 0x00}
#define OFF {0,0,0}
int ws2812_init(ws2812_t *dev, spi_t spi);
int ws2812_write(ws2812_t *dev, char *b, unsigned len);
int ws2812_write_rgb(ws2812_t *dev, ws2812_rgb_t *leds, unsigned len, char* buffer);
void ws2812_fill_rgb(ws2812_rgb_t *leds, unsigned len, char* buffer);