musiclight2/sk6812.h

37 lines
1.2 KiB
C

/*
* vim: sw=2 ts=2 expandtab
*
* "THE PIZZA-WARE LICENSE" (derived from "THE BEER-WARE LICENCE"):
* Thomas Kolb <cfr34k@tkolb.de> wrote this file. As long as you retain this
* notice you can do whatever you want with this stuff. If we meet some day,
* and you think this stuff is worth it, you can buy me a pizza in return.
* - Thomas Kolb
*/
#ifndef SK6812_H
#define SK6812_H
struct __attribute__((__packed__)) SK6812Packet {
uint8_t action;
uint8_t strip;
uint8_t module;
uint8_t data[4];
};
struct sk6812_ctx {
int socket;
struct __attribute__((__packed__)) SK6812Packet packetQueue[1024];
int queueIndex;
};
int sk6812_init(struct sk6812_ctx *ctx, const char *host, unsigned short port);
void sk6812_set_color(struct sk6812_ctx *ctx, uint8_t strip, uint16_t module, uint8_t r, uint8_t g, uint8_t b, uint8_t w);
void sk6812_fade_color(struct sk6812_ctx *ctx, uint8_t strip, uint16_t module, uint8_t r, uint8_t g, uint8_t b, uint8_t w);
void sk6812_add_color(struct sk6812_ctx *ctx, uint8_t strip, uint16_t module, uint8_t r, uint8_t g, uint8_t b, uint8_t w);
void sk6812_set_fadestep(struct sk6812_ctx *ctx, uint8_t fadestep);
int sk6812_commit(struct sk6812_ctx *ctx);
void sk6812_shutdown(struct sk6812_ctx *ctx);
#endif // SK6812_H