From dd91621ccee033550312683293b5bf40c3599053 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 23 Feb 2020 18:20:12 +0100 Subject: Implement OpenPixelControl output --- backends/openpixelcontrol.h | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 backends/openpixelcontrol.h (limited to 'backends/openpixelcontrol.h') diff --git a/backends/openpixelcontrol.h b/backends/openpixelcontrol.h new file mode 100644 index 0000000..f1061ea --- /dev/null +++ b/backends/openpixelcontrol.h @@ -0,0 +1,48 @@ +#include "midimonster.h" + +MM_PLUGIN_API int init(); +static int openpixel_configure(char* option, char* value); +static int openpixel_configure_instance(instance* inst, char* option, char* value); +static int openpixel_instance(instance* inst); +static channel* openpixel_channel(instance* inst, char* spec, uint8_t flags); +static int openpixel_set(instance* inst, size_t num, channel** c, channel_value* v); +static int openpixel_handle(size_t num, managed_fd* fds); +static int openpixel_start(size_t n, instance** inst); +static int openpixel_shutdown(size_t n, instance** inst); + +#define OPENPIXEL_INPUT 1 +#define OPENPIXEL_MARK 2 + +typedef struct /*_data_buffer*/ { + uint8_t strip; + uint8_t flags; + uint16_t bytes; + union { + uint16_t* u16; + uint8_t* u8; + } data; +} openpixel_buffer; + +#pragma pack(push, 1) +typedef struct /*_openpixel_hdr*/ { + uint8_t strip; + uint8_t mode; + uint16_t length; +} openpixel_header; +#pragma pack(pop) + +typedef struct { + enum { + rgb8 = 0, + rgb16 = 2 + } mode; + + size_t buffers; + openpixel_buffer* buffer; + + int dest_fd; + int listen_fd; + size_t clients; + int* client_fd; + size_t* bytes_left; +} openpixel_instance_data; -- cgit v1.2.3 From e1fcd4d11cfdbad54470b2cce98d8b749464ec00 Mon Sep 17 00:00:00 2001 From: cbdev Date: Thu, 27 Feb 2020 00:33:22 +0100 Subject: Implement OpenPixelControl server mode (8bit) --- backends/openpixelcontrol.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'backends/openpixelcontrol.h') diff --git a/backends/openpixelcontrol.h b/backends/openpixelcontrol.h index f1061ea..658bbf0 100644 --- a/backends/openpixelcontrol.h +++ b/backends/openpixelcontrol.h @@ -31,6 +31,18 @@ typedef struct /*_openpixel_hdr*/ { } openpixel_header; #pragma pack(pop) +typedef struct /*_openpixel_client*/ { + int fd; + ssize_t buffer; + openpixel_header hdr; + size_t offset; + size_t left; + union { + uint8_t u8[2]; + uint16_t u16; + } boundary; +} openpixel_client; + typedef struct { enum { rgb8 = 0, @@ -43,6 +55,5 @@ typedef struct { int dest_fd; int listen_fd; size_t clients; - int* client_fd; - size_t* bytes_left; + openpixel_client* client; } openpixel_instance_data; -- cgit v1.2.3 From cff53b6fb1996a24dbdef3657e4fac6558913c33 Mon Sep 17 00:00:00 2001 From: cbdev Date: Fri, 28 Feb 2020 18:54:35 +0100 Subject: Restructure openpixelcontrol --- backends/openpixelcontrol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends/openpixelcontrol.h') diff --git a/backends/openpixelcontrol.h b/backends/openpixelcontrol.h index 658bbf0..63e9664 100644 --- a/backends/openpixelcontrol.h +++ b/backends/openpixelcontrol.h @@ -33,7 +33,7 @@ typedef struct /*_openpixel_hdr*/ { typedef struct /*_openpixel_client*/ { int fd; - ssize_t buffer; + ssize_t buffer; /* -1 header, -2 ignore, -3 bcast */ openpixel_header hdr; size_t offset; size_t left; -- cgit v1.2.3