2018-06-24 22:23:39 +02:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2018-06-30 01:42:34 +02:00
|
|
|
struct __attribute__((__packed__)) SK6812Packet {
|
|
|
|
uint8_t action;
|
2018-08-14 21:52:33 +02:00
|
|
|
uint8_t strip;
|
2019-12-17 22:09:53 +01:00
|
|
|
uint8_t module;
|
2018-06-30 01:42:34 +02:00
|
|
|
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);
|
2018-08-14 21:52:33 +02:00
|
|
|
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);
|
2018-06-30 01:42:34 +02:00
|
|
|
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);
|
2018-06-24 22:23:39 +02:00
|
|
|
|
|
|
|
#endif // SK6812_H
|