diff options
author | cbdev <cb@cbcdn.com> | 2020-03-23 00:15:00 +0100 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2020-03-23 00:15:00 +0100 |
commit | 37e712edf23a49be5387f945ab9ea57cc0b57f22 (patch) | |
tree | 5037b14bdbd08baa8f104f7e4946aa5643281a94 /backends/openpixelcontrol.h | |
parent | 666aec036f9bf0de82c435bd7eace271613cee1e (diff) | |
parent | aa02ccf3abf183207b24fcbb9460cbd904a698e2 (diff) | |
download | midimonster-37e712edf23a49be5387f945ab9ea57cc0b57f22.tar.gz midimonster-37e712edf23a49be5387f945ab9ea57cc0b57f22.tar.bz2 midimonster-37e712edf23a49be5387f945ab9ea57cc0b57f22.zip |
Merge current master
Diffstat (limited to 'backends/openpixelcontrol.h')
-rw-r--r-- | backends/openpixelcontrol.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/backends/openpixelcontrol.h b/backends/openpixelcontrol.h new file mode 100644 index 0000000..63e9664 --- /dev/null +++ b/backends/openpixelcontrol.h @@ -0,0 +1,59 @@ +#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 /*_openpixel_client*/ { + int fd; + ssize_t buffer; /* -1 header, -2 ignore, -3 bcast */ + 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, + rgb16 = 2 + } mode; + + size_t buffers; + openpixel_buffer* buffer; + + int dest_fd; + int listen_fd; + size_t clients; + openpixel_client* client; +} openpixel_instance_data; |