rewrite commands flow for static commands
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Dmitry Isaenko 2025-02-02 16:02:20 +03:00
parent b369d7fb77
commit 9a7da25043
2 changed files with 420 additions and 375 deletions

View file

@ -20,6 +20,15 @@
#include "commands.c"
#include "iousb.c"
struct separate_c{
char *command1, *command2, *command3, *command4, *command5, *command6;
int red1, red2, red3, red4, red5, red6;
int green1, green2, green3, green4, green5, green6;
int blue1, blue2, blue3, blue4, blue5, blue6;
int brightness1, brightness2, brightness3, brightness4, brightness5, brightness6;
int intensity1, intensity2, intensity3, intensity4, intensity5, intensity6;
} sc;
void parse_color(char *color, unsigned int *red, unsigned int *green, unsigned int *blue ){
if (strlen(color) != 6){
printf("Incorrect color: \"%s\". Using default: \"ffffff\"\n", color);
@ -67,34 +76,60 @@ int sync_flow(char* command, unsigned int red, unsigned int green, unsigned int
}
}
int separate_flow(char *command1, int red1, int green1, int blue1, int brightness1, int intensity1,
char *command2, int red2, int green2, int blue2, int brightness2, int intensity2,
char *command3, int red3, int green3, int blue3, int brightness3, int intensity3,
char *command4, int red4, int green4, int blue4, int brightness4, int intensity4,
char *command5, int red5, int green5, int blue5, int brightness5, int intensity5,
char *command6, int red6, int green6, int blue6, int brightness6, int intensity6 ){
if (strcmp(command1, "color") == 0)
return staticColorSeparate(brightness1, red1, green1, blue1);
else if (strcmp(command1, "off") == 0)
return turnOffBacklight();
else if (strcmp(command1, "impulse") == 0)
return impulse(intensity1, red1, green1, blue1);
else if (strcmp(command1, "flash") == 0)
return flash(brightness1, intensity1, red1, green1, blue1);
else if (strcmp(command1, "flash2") == 0)
return doubleFlash(brightness1, intensity1, red1, green1, blue1);
else if (strcmp(command1, "cycle") == 0)
return cycle(intensity1, brightness1);
int parse_single_separate(static_commands_set *s, int dev_number, char *command,
int red, int green, int blue,
int brightness, int intensity){
if (strcmp(command, "color") == 0){
if (staticOneColor(dev_number, s, brightness, red, green, blue))
return -1;
}
else if (strcmp(command, "off") == 0){
if (staticOff(dev_number, s))
return -1;
}
else if (strcmp(command, "impulse") == 0){
if (staticImpulse(dev_number, s, intensity, red, green, blue))
return -1;
}
else if (strcmp(command, "flash") == 0){
if (staticFlash(dev_number, s, brightness, intensity, red, green, blue))
return -1;
}
else if (strcmp(command, "flash2") == 0){
if (staticFlash2(dev_number, s, brightness, intensity, red, green, blue))
return -1;
}
else if (strcmp(command, "cycle") == 0){
if (staticCycle(dev_number, s, intensity, brightness))
return -1;
}
else{
printf("Invalid command \"%s\"\n"
"Allowed: color off impulse flash flash2 cycle\n", command1);
return staticColorSync(red1, green1, blue1); // TODO: FIX ME
"Allowed: color off impulse flash flash2 cycle\n", command);
return -1;
}
return 0;
}
int separate_flow(){
//FIXME
static_commands_set s;
if (parse_single_separate(&s, 1, sc.command1, sc.red1, sc.green1, sc.blue1, sc.brightness1, sc.intensity1))
return staticColorSync(sc.red1, sc.green1, sc.blue1); // TODO: FIX ME
if (parse_single_separate(&s, 2, sc.command2, sc.red2, sc.green2, sc.blue2, sc.brightness2, sc.intensity2))
return staticColorSync(sc.red2, sc.green2, sc.blue2); // TODO: FIX ME
if (parse_single_separate(&s, 3, sc.command3, sc.red3, sc.green3, sc.blue3, sc.brightness3, sc.intensity3))
return staticColorSync(sc.red3, sc.green3, sc.blue3); // TODO: FIX ME
if (parse_single_separate(&s, 4, sc.command4, sc.red4, sc.green4, sc.blue4, sc.brightness4, sc.intensity4))
return staticColorSync(sc.red4, sc.green4, sc.blue4); // TODO: FIX ME
if (parse_single_separate(&s, 5, sc.command5, sc.red5, sc.green5, sc.blue5, sc.brightness5, sc.intensity5))
return staticColorSync(sc.red5, sc.green5, sc.blue5); // TODO: FIX ME
if (parse_single_separate(&s, 6, sc.command6, sc.red6, sc.green6, sc.blue6, sc.brightness6, sc.intensity6))
return staticColorSync(sc.red6, sc.green6, sc.blue6); // TODO: FIX ME
return runStaticCommand(s);
}
int main(int argc, char *argv[]) {
@ -122,50 +157,39 @@ int main(int argc, char *argv[]) {
printf("Only one option must be defined: '-s' or '-e'\n");
return -1;
}
/*
if (arguments.separate && ){
printf("In separate flow each zone has to be defined: '-z1=color -z2=impulse ... -z6=color'\n");
return -1;
}
*/
unsigned int red, green, blue,
red1, green1, blue1,
red2, green2, blue2,
red3, green3, blue3,
red4, green4, blue4,
red5, green5, blue5,
red6, green6, blue6,
brightness,
brightness1, brightness2, brightness3,
brightness4, brightness5, brightness6,
intensity1, intensity2, intensity3,
intensity4, intensity5, intensity6;
unsigned int red, green, blue, brightness;
parse_color(arguments.color, &red, &green, &blue);
brightness = parse_brightness(arguments.brightness);
if (arguments.separate == 1){
parse_color(arguments.c1, &red1, &green1, &blue1);
parse_color(arguments.c2, &red2, &green2, &blue2);
parse_color(arguments.c3, &red3, &green3, &blue3);
parse_color(arguments.c4, &red4, &green4, &blue4);
parse_color(arguments.c5, &red5, &green5, &blue5);
parse_color(arguments.c6, &red6, &green6, &blue6);
sc.command1 = arguments.z1;
sc.command2 = arguments.z2;
sc.command3 = arguments.z3;
sc.command4 = arguments.z4;
sc.command5 = arguments.z5;
sc.command6 = arguments.z6;
brightness1 = parse_brightness(arguments.b1);
brightness2 = parse_brightness(arguments.b2);
brightness3 = parse_brightness(arguments.b3);
brightness4 = parse_brightness(arguments.b4);
brightness5 = parse_brightness(arguments.b5);
brightness6 = parse_brightness(arguments.b6);
parse_color(arguments.c1, &sc.red1, &sc.green1, &sc.blue1);
parse_color(arguments.c2, &sc.red2, &sc.green2, &sc.blue2);
parse_color(arguments.c3, &sc.red3, &sc.green3, &sc.blue3);
parse_color(arguments.c4, &sc.red4, &sc.green4, &sc.blue4);
parse_color(arguments.c5, &sc.red5, &sc.green5, &sc.blue5);
parse_color(arguments.c6, &sc.red6, &sc.green6, &sc.blue6);
intensity1 = parse_brightness(arguments.i1);
intensity2 = parse_brightness(arguments.i2);
intensity3 = parse_brightness(arguments.i3);
intensity4 = parse_brightness(arguments.i4);
intensity5 = parse_brightness(arguments.i5);
intensity6 = parse_brightness(arguments.i6);
sc.brightness1 = parse_brightness(arguments.b1);
sc.brightness2 = parse_brightness(arguments.b2);
sc.brightness3 = parse_brightness(arguments.b3);
sc.brightness4 = parse_brightness(arguments.b4);
sc.brightness5 = parse_brightness(arguments.b5);
sc.brightness6 = parse_brightness(arguments.b6);
sc.intensity1 = parse_brightness(arguments.i1);
sc.intensity2 = parse_brightness(arguments.i2);
sc.intensity3 = parse_brightness(arguments.i3);
sc.intensity4 = parse_brightness(arguments.i4);
sc.intensity5 = parse_brightness(arguments.i5);
sc.intensity6 = parse_brightness(arguments.i6);
}
// - - -
@ -195,12 +219,7 @@ int main(int argc, char *argv[]) {
}
}
else if (arguments.separate == 1){ // Separate flow
if (separate_flow(arguments.z1, red1, green1, blue1, brightness1, intensity1,
arguments.z2, red2, green2, blue2, brightness2, intensity2,
arguments.z3, red3, green3, blue3, brightness3, intensity3,
arguments.z4, red4, green4, blue4, brightness4, intensity4,
arguments.z5, red5, green5, blue5, brightness5, intensity5,
arguments.z6, red6, green6, blue6, brightness6, intensity6)){
if (separate_flow(&sc)){
printf("Command transfer failure\n");
libusb_close(dev_handle);
return -1;

View file

@ -54,122 +54,6 @@ int prefix(){
return 0;
}
int staticColorSeparate(int brightness, unsigned char red, unsigned char green, unsigned char blue){
unsigned char brgt;
switch (brightness){
case 0:
brgt = 0x1a;
break;
case 1:
brgt = 0x4d;
break;
case 2:
brgt = 0x80;
break;
case 3:
brgt = 0xb3;
break;
case 4:
brgt = 0xff;
break;
default:
printf("Brightness must be defined in range of 0..4\n");
return 1;
}
if (prefix())
return 1;
counter = 0;
limit = 7;
//cc 22 04 00 00 00 00 00 00 00 00 01 __ 00 __ __ __
unsigned char dir1[64] = { 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brgt, 0x00, blue, green, red, };
//cc 24 10 00 00 00 00 00 00 00 00 01 __ 00 __ __ __
unsigned char dir2[64] = { 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brgt, 0x00, blue, green, red, };
//cc 25 20 00 00 00 00 00 00 00 00 01 __ 00 __ __ __
unsigned char dir3[64] = { 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brgt, 0x00, blue, green, red, };
//cc 26 40 00 00 00 00 00 00 00 00 01 __ 00 __ __ __
unsigned char dir4[64] = { 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brgt, 0x00, blue, green, red, };
//cc 27 80 00 00 00 00 00 00 00 00 01 __ 00 __ __ __
unsigned char dir5[64] = { 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brgt, 0x00, blue, green, red, };
//cc 91 00 02 00 00 00 00 00 00 00 01 __ 00 __ __ __
unsigned char dir6[64] = { 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brgt, 0x00, blue, green, red, };
if(64 != writeUsb(dir1))
return 1;
if(64 != writeUsb(dir2))
return 1;
if(64 != writeUsb(dir3))
return 1;
if(64 != writeUsb(dir4))
return 1;
if(64 != writeUsb(dir5))
return 1;
if(64 != writeUsb(dir6))
return 1;
if(64 != writeUsb(end_transaction))
return 1;
printf("One color (Separate) applied\n");
return 0;
}
int turnOffBacklight(){
if (prefix())
return 0;
counter = 0;
limit = 7;
//cc 22 04 00 00 00 00 00 00 00 00 01 ff
unsigned char dir1[64] = { 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
//cc 24 10 00 00 00 00 00 00 00 00 01 ff
unsigned char dir2[64] = { 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
//cc 25 20 00 00 00 00 00 00 00 00 01 ff
unsigned char dir3[64] = { 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
//cc 26 40 00 00 00 00 00 00 00 00 01 ff
unsigned char dir4[64] = { 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
//cc 27 80 00 00 00 00 00 00 00 00 01 ff
unsigned char dir5[64] = { 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
//cc 91 00 02 00 00 00 00 00 00 00 01 ff
unsigned char dir6[64] = { 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
if(64 != writeUsb(dir1))
return 1;
if(64 != writeUsb(dir2))
return 1;
if(64 != writeUsb(dir3))
return 1;
if(64 != writeUsb(dir4))
return 1;
if(64 != writeUsb(dir5))
return 1;
if(64 != writeUsb(dir6))
return 1;
if(64 != writeUsb(end_transaction))
return 1;
printf("Turn off backlight (Separate) applied\n");
return 0;
}
int turnOffBacklightSync(){
if (prefix())
return 0;
@ -259,31 +143,56 @@ int staticColorSync(unsigned char red, unsigned char green, unsigned char blue){
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
typedef enum{
EFFECT_COLOR,
EFFECT_OFF,
EFFECT_IMPULSE,
EFFECT_FLASH,
EFFECT_DOUBLE_FLASH,
EFFECT_CYCLE
} STATIC_EFFECT;
int impulse(int intensity, unsigned char red, unsigned char green, unsigned char blue){
typedef struct {
STATIC_EFFECT name1;
STATIC_EFFECT name2;
STATIC_EFFECT name3;
STATIC_EFFECT name4;
STATIC_EFFECT name5;
STATIC_EFFECT name6;
unsigned char* dir1;
unsigned char* dir2;
unsigned char* dir3;
unsigned char* dir4;
unsigned char* dir5;
unsigned char* dir6;
} static_commands_set;
unsigned char *I;
switch (intensity){
case 0:
I = (unsigned char [6]) { 0x40, 0x06, 0x40, 0x06, 0x20, 0x03 }; // 400640062003
void print_ext_report(STATIC_EFFECT effect){
switch (effect)
{
case EFFECT_COLOR:
printf("* One color\n");
break;
case 1:
I = (unsigned char [6]) { 0xb0, 0x04, 0xb0, 0x04, 0xf4, 0x01 }; // b004b004f401
case EFFECT_OFF:
printf("* Off\n");
break;
case 2:
I = (unsigned char [6]) { 0x84, 0x03, 0x84, 0x03, 0xc2, 0x01 }; // 84038403c201
case EFFECT_IMPULSE:
printf("* Impulse\n");
break;
case 3:
I = (unsigned char [6]) { 0xbc, 0x02, 0xbc, 0x02, 0x5e, 0x01 }; // bc02bc025e01
case EFFECT_FLASH:
printf("* Flash\n");
break;
case 4:
I = (unsigned char [6]) { 0xf4, 0x01, 0xf4, 0x01, 0xfa, 0x00 }; // f401f401fa00
case EFFECT_DOUBLE_FLASH:
printf("* Double flash\n");
break;
case EFFECT_CYCLE:
printf("* Cycle\n");
break;
default:
printf("Intensity must be defined in range of 0..4\n");
return 1;
}
}
int runStaticCommand(static_commands_set c_set){
if (prefix())
return 1;
@ -291,53 +200,40 @@ int impulse(int intensity, unsigned char red, unsigned char green, unsigned char
counter = 0;
limit = 7;
//cc22040000000000000000026400______0000000000____________00000001
unsigned char dir1[64] = { 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x64, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], I[4], I[5], 0x00, 0x00, 0x00, 0x01, };
//cc24100000000000000000026400______0000000000____________00000001
unsigned char dir2[64] = { 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x64, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], I[4], I[5], 0x00, 0x00, 0x00, 0x01, };
//cc25200000000000000000026400______0000000000____________00000001
unsigned char dir3[64] = { 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x64, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], I[4], I[5], 0x00, 0x00, 0x00, 0x01, };
//cc26400000000000000000026400______0000000000____________00000001
unsigned char dir4[64] = { 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x64, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], I[4], I[5], 0x00, 0x00, 0x00, 0x01, };
//cc27800000000000000000026400______0000000000____________00000001
unsigned char dir5[64] = { 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x64, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], I[4], I[5], 0x00, 0x00, 0x00, 0x01, };
//cc91000200000000000000026400______0000000000____________00000001
unsigned char dir6[64] = { 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x64, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], I[4], I[5], 0x00, 0x00, 0x00, 0x01, };
if(64 != writeUsb(dir1))
if(64 != writeUsb(c_set.dir1))
return 1;
if(64 != writeUsb(dir2))
if(64 != writeUsb(c_set.dir2))
return 1;
if(64 != writeUsb(dir3))
if(64 != writeUsb(c_set.dir3))
return 1;
if(64 != writeUsb(dir4))
if(64 != writeUsb(c_set.dir4))
return 1;
if(64 != writeUsb(dir5))
if(64 != writeUsb(c_set.dir5))
return 1;
if(64 != writeUsb(dir6))
if(64 != writeUsb(c_set.dir6))
return 1;
if(64 != writeUsb(end_transaction))
return 1;
printf("Impulse (Separate) applied\n");
printf("Commands sent:\n");
print_ext_report(c_set.name1);
print_ext_report(c_set.name2);
print_ext_report(c_set.name3);
print_ext_report(c_set.name4);
print_ext_report(c_set.name5);
print_ext_report(c_set.name6);
return 0;
}
// flash - 1 = brighness; 2 - frequency
int flash(int brightness, int frequency, unsigned char red, unsigned char green, unsigned char blue){
//int staticOneColor(int dev_number, unsigned char* save_to, int brightness, unsigned char red, unsigned char green, unsigned char blue){
int staticOneColor(int dev_number, static_commands_set *s, int brightness, unsigned char red, unsigned char green, unsigned char blue){
unsigned char brgt;
@ -358,7 +254,163 @@ int flash(int brightness, int frequency, unsigned char red, unsigned char green,
brgt = 0xff;
break;
default:
printf("Brightness must be defined in range of 0..4\n");
printf("Brightness must be in range of 0..4\n");
return 1;
}
switch (dev_number){
case 1: //cc 22 04 00 00 00 00 00 00 00 00 01 __ 00 __ __ __
s->name1 = EFFECT_COLOR;
s->dir1 = (unsigned char [64]){ 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brgt, 0x00, blue, green, red, };
break;
case 2: //cc 24 10 00 00 00 00 00 00 00 00 01 __ 00 __ __ __
s->name2 = EFFECT_COLOR;
s->dir2 = (unsigned char [64]){ 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brgt, 0x00, blue, green, red, };
break;
case 3: //cc 25 20 00 00 00 00 00 00 00 00 01 __ 00 __ __ __
s->name3 = EFFECT_COLOR;
s->dir3 = (unsigned char [64]){ 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brgt, 0x00, blue, green, red, };
break;
case 4: //cc 26 40 00 00 00 00 00 00 00 00 01 __ 00 __ __ __
s->name4 = EFFECT_COLOR;
s->dir4 = (unsigned char [64]){ 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brgt, 0x00, blue, green, red, };
break;
case 5: //cc 27 80 00 00 00 00 00 00 00 00 01 __ 00 __ __ __
s->name5 = EFFECT_COLOR;
s->dir5 = (unsigned char [64]){ 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brgt, 0x00, blue, green, red, };
break;
case 6: //cc 91 00 02 00 00 00 00 00 00 00 01 __ 00 __ __ __
s->name6 = EFFECT_COLOR;
s->dir6 = (unsigned char [64]){ 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brgt, 0x00, blue, green, red, };
break;
default:
printf("Device number must be in range of 1..6\n");
return 1;
}
return 0;
}
int staticOff(int dev_number, static_commands_set *s){
switch (dev_number){
case 1: //cc 22 04 00 00 00 00 00 00 00 00 01 ff
s->name1 = EFFECT_OFF;
s->dir1 = (unsigned char [64]){ 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
break;
case 2: //cc 24 10 00 00 00 00 00 00 00 00 01 ff
s->name2 = EFFECT_OFF;
s->dir2 = (unsigned char [64]){ 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
break;
case 3: //cc 25 20 00 00 00 00 00 00 00 00 01 ff
s->name3 = EFFECT_OFF;
s->dir3 = (unsigned char [64]){ 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
break;
case 4: //cc 26 40 00 00 00 00 00 00 00 00 01 ff
s->name4 = EFFECT_OFF;
s->dir4 = (unsigned char [64]){ 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
break;
case 5: //cc 27 80 00 00 00 00 00 00 00 00 01 ff
s->name5 = EFFECT_OFF;
s->dir5 = (unsigned char [64]){ 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
break;
case 6: //cc 91 00 02 00 00 00 00 00 00 00 01 ff
s->name6 = EFFECT_OFF;
s->dir6 = (unsigned char [64]){ 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
break;
default:
printf("Device number must be in range of 1..6\n");
return 1;
}
return 0;
}
int staticImpulse(int dev_number, static_commands_set *s, int intensity, unsigned char red, unsigned char green, unsigned char blue){
unsigned char *I;
switch (intensity){
case 0:
I = (unsigned char [6]) { 0x40, 0x06, 0x40, 0x06, 0x20, 0x03 }; // 400640062003
break;
case 1:
I = (unsigned char [6]) { 0xb0, 0x04, 0xb0, 0x04, 0xf4, 0x01 }; // b004b004f401
break;
case 2:
I = (unsigned char [6]) { 0x84, 0x03, 0x84, 0x03, 0xc2, 0x01 }; // 84038403c201
break;
case 3:
I = (unsigned char [6]) { 0xbc, 0x02, 0xbc, 0x02, 0x5e, 0x01 }; // bc02bc025e01
break;
case 4:
I = (unsigned char [6]) { 0xf4, 0x01, 0xf4, 0x01, 0xfa, 0x00 }; // f401f401fa00
break;
default:
printf("Intensity must be in range of 0..4\n");
return 1;
}
switch (dev_number){
case 1: //cc 22 04 00 00 00 00 00 00 00 00 02 64 00 __ __ __ 00 00 00 00 00 __ __ __ __ __ __ 00 00 00 01
s->name1 = EFFECT_IMPULSE;
s->dir1 = (unsigned char [64]){ 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x64, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], I[4], I[5], 0x00, 0x00, 0x00, 0x01, };
break;
case 2: //cc 24 10 00 00 00 00 00 00 00 00 02 64 00 __ __ __ 00 00 00 00 00 __ __ __ __ __ __ 00 00 00 01
s->name2 = EFFECT_IMPULSE;
s->dir2 = (unsigned char [64]){ 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x64, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], I[4], I[5], 0x00, 0x00, 0x00, 0x01, };
break;
case 3: //cc 25 20 00 00 00 00 00 00 00 00 02 64 00 __ __ __ 00 00 00 00 00 __ __ __ __ __ __ 00 00 00 01
s->name3 = EFFECT_IMPULSE;
s->dir3 = (unsigned char [64]){ 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x64, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], I[4], I[5], 0x00, 0x00, 0x00, 0x01, };
break;
case 4: //cc 26 40 00 00 00 00 00 00 00 00 02 64 00 __ __ __ 00 00 00 00 00 __ __ __ __ __ __ 00 00 00 01
s->name4 = EFFECT_IMPULSE;
s->dir4 = (unsigned char [64]){ 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x64, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], I[4], I[5], 0x00, 0x00, 0x00, 0x01, };
break;
case 5: //cc 27 80 00 00 00 00 00 00 00 00 02 64 00 __ __ __ 00 00 00 00 00 __ __ __ __ __ __ 00 00 00 01
s->name5 = EFFECT_IMPULSE;
s->dir5 = (unsigned char [64]){ 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x64, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], I[4], I[5], 0x00, 0x00, 0x00, 0x01, };
break;
case 6: //cc 91 00 02 00 00 00 00 00 00 00 02 64 00 __ __ __ 00 00 00 00 00 __ __ __ __ __ __ 00 00 00 01
s->name6 = EFFECT_IMPULSE;
s->dir6 = (unsigned char [64]){ 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x64, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], I[4], I[5], 0x00, 0x00, 0x00, 0x01, };
break;
default:
printf("Device number must be in range of 1..6\n");
return 1;
}
return 0;
}
// flash - 1 = brighness; 2 - frequency
int staticFlash(int dev_number, static_commands_set *s, int brightness, int frequency, unsigned char red, unsigned char green, unsigned char blue){
unsigned char brgt;
switch (brightness){
case 0:
brgt = 0x1a;
break;
case 1:
brgt = 0x4d;
break;
case 2:
brgt = 0x80;
break;
case 3:
brgt = 0xb3;
break;
case 4:
brgt = 0xff;
break;
default:
printf("Brightness must be in range of 0..4\n");
return 1;
}
@ -381,62 +433,56 @@ int flash(int brightness, int frequency, unsigned char red, unsigned char green,
F = (unsigned char [2]) { 0x20, 0x03 }; // 2003
break;
default:
printf("Frequency must be defined in range of 0..4\n");
printf("Frequency must be in range of 0..4\n");
return 1;
}
// cc2204000000000000000003__00______000000000064006400____0000000101
unsigned char dir1[64] = { 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
switch (dev_number){
case 1: //cc 22 04 00 00 00 00 00 00 00 00 03 __ 00 __ __ __ 00 00 00 00 00 64 00 64 00 __ __ 00 00 00 01 01
s->name1 = EFFECT_FLASH;
s->dir1 = (unsigned char [64]){ 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, F[0], F[1], 0x00, 0x00, 0x00, 0x01,
0x01, };
// cc2410000000000000000003__00______000000000064006400____0000000101
unsigned char dir2[64] = { 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
break;
case 2: //cc 24 10 00 00 00 00 00 00 00 00 03 __ 00 __ __ __ 00 00 00 00 00 64 00 64 00 __ __ 00 00 00 01 01
s->name2 = EFFECT_FLASH;
s->dir2 = (unsigned char [64]){ 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, F[0], F[1], 0x00, 0x00, 0x00, 0x01,
0x01, };
// cc2520000000000000000003__00______000000000064006400____0000000101
unsigned char dir3[64] = { 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
break;
case 3: //cc 25 20 00 00 00 00 00 00 00 00 03 __ 00 __ __ __ 00 00 00 00 00 64 00 64 00 __ __ 00 00 00 01 01
s->name3 = EFFECT_FLASH;
s->dir3 = (unsigned char [64]){ 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, F[0], F[1], 0x00, 0x00, 0x00, 0x01,
0x01, };
// cc2640000000000000000003__00______000000000064006400____0000000101
unsigned char dir4[64] = { 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
break;
case 4: //cc 26 40 00 00 00 00 00 00 00 00 03 __ 00 __ __ __ 00 00 00 00 00 64 00 64 00 __ __ 00 00 00 01 01
s->name4 = EFFECT_FLASH;
s->dir4 = (unsigned char [64]){ 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, F[0], F[1], 0x00, 0x00, 0x00, 0x01,
0x01, };
// cc2780000000000000000003__00______000000000064006400____0000000101
unsigned char dir5[64] = { 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
break;
case 5: //cc 27 80 00 00 00 00 00 00 00 00 03 __ 00 __ __ __ 00 00 00 00 00 64 00 64 00 __ __ 00 00 00 01 01
s->name5 = EFFECT_FLASH;
s->dir5 = (unsigned char [64]){ 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, F[0], F[1], 0x00, 0x00, 0x00, 0x01,
0x01, };
// cc9100020000000000000003__00______000000000064006400____0000000101
unsigned char dir6[64] = { 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
break;
case 6: //cc 91 00 02 00 00 00 00 00 00 00 03 __ 00 __ __ __ 00 00 00 00 00 64 00 64 00 __ __ 00 00 00 01 01
s->name6 = EFFECT_FLASH;
s->dir6 = (unsigned char [64]){ 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, F[0], F[1], 0x00, 0x00, 0x00, 0x01,
0x01, };
if(64 != writeUsb(dir1))
break;
default:
printf("Device number must be in range of 1..6\n");
return 1;
if(64 != writeUsb(dir2))
return 1;
if(64 != writeUsb(dir3))
return 1;
if(64 != writeUsb(dir4))
return 1;
if(64 != writeUsb(dir5))
return 1;
if(64 != writeUsb(dir6))
return 1;
if(64 != writeUsb(end_transaction))
return 1;
printf("Flash (Separate) applied\n");
}
return 0;
}
int doubleFlash(int brightness, int frequency, unsigned char red, unsigned char green, unsigned char blue){
int staticFlash2(int dev_number, static_commands_set *s, int brightness, int frequency, unsigned char red, unsigned char green, unsigned char blue){
unsigned char brgt;
@ -457,7 +503,7 @@ int doubleFlash(int brightness, int frequency, unsigned char red, unsigned char
brgt = 0xff;
break;
default:
printf("Brightness must be defined in range of 0..4\n");
printf("Brightness must be in range of 0..4\n");
return 1;
}
@ -480,68 +526,58 @@ int doubleFlash(int brightness, int frequency, unsigned char red, unsigned char
F = (unsigned char [2]) { 0xe8, 0x03 }; // e803
break;
default:
printf("Frequency must be defined in range of 0..4\n");
printf("Frequency must be in range of 0..4\n");
return 1;
}
//cc2204000000000000000003__00______000000000064006400____0000000102
unsigned char dir1[64] = { 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
switch (dev_number){
case 1: //cc 22 04 00 00 00 00 00 00 00 00 03 __ 00 __ __ __ 00 00 00 00 00 64 00 64 00 __ __ 00 00 00 01 02
s->name1 = EFFECT_DOUBLE_FLASH;
s->dir1 = (unsigned char [64]){ 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, F[0], F[1], 0x00, 0x00, 0x00, 0x01,
0x02, };
//cc2410000000000000000003__00______000000000064006400____0000000102
unsigned char dir2[64] = { 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
break;
case 2: //cc 24 10 00 00 00 00 00 00 00 00 03 __ 00 __ __ __ 00 00 00 00 00 64 00 64 00 __ __ 00 00 00 01 02
s->name2 = EFFECT_DOUBLE_FLASH;
s->dir2 = (unsigned char [64]){ 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, F[0], F[1], 0x00, 0x00, 0x00, 0x01,
0x02, };
//cc2520000000000000000003__00______000000000064006400____0000000102
unsigned char dir3[64] = { 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
break;
case 3: //cc 25 20 00 00 00 00 00 00 00 00 03 __ 00 __ __ __ 00 00 00 00 00 64 00 64 00 __ __ 00 00 00 01 02
s->name3 = EFFECT_DOUBLE_FLASH;
s->dir3 = (unsigned char [64]){ 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, F[0], F[1], 0x00, 0x00, 0x00, 0x01,
0x02, };
//cc2640000000000000000003__00______000000000064006400____0000000102
unsigned char dir4[64] = { 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
break;
case 4: //cc 26 40 00 00 00 00 00 00 00 00 03 __ 00 __ __ __ 00 00 00 00 00 64 00 64 00 __ __ 00 00 00 01 02
s->name4 = EFFECT_DOUBLE_FLASH;
s->dir4 = (unsigned char [64]){ 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, F[0], F[1], 0x00, 0x00, 0x00, 0x01,
0x02, };
//cc2780000000000000000003__00______000000000064006400____0000000102
unsigned char dir5[64] = { 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
break;
case 5: //cc 27 80 00 00 00 00 00 00 00 00 03 __ 00 __ __ __ 00 00 00 00 00 64 00 64 00 __ __ 00 00 00 01 02
s->name5 = EFFECT_DOUBLE_FLASH;
s->dir5 = (unsigned char [64]){ 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, F[0], F[1], 0x00, 0x00, 0x00, 0x01,
0x02, };
//cc9100020000000000000003__00______000000000064006400____0000000102
unsigned char dir6[64] = { 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
break;
case 6: //cc 91 00 02 00 00 00 00 00 00 00 03 __ 00 __ __ __ 00 00 00 00 00 64 00 64 00 __ __ 00 00 00 01 02
s->name6 = EFFECT_DOUBLE_FLASH;
s->dir6 = (unsigned char [64]){ 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, brgt, 0x00, blue, green,
red, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, F[0], F[1], 0x00, 0x00, 0x00, 0x01,
0x02, };
counter = 0;
limit = 7;
if(64 != writeUsb(dir1))
break;
default:
printf("Device number must be in range of 1..6\n");
return 1;
if(64 != writeUsb(dir2))
return 1;
if(64 != writeUsb(dir3))
return 1;
if(64 != writeUsb(dir4))
return 1;
if(64 != writeUsb(dir5))
return 1;
if(64 != writeUsb(dir6))
return 1;
if(64 != writeUsb(end_transaction))
return 1;
printf("Double flash (Separate) applied\n");
}
return 0;
}
int cycle(int intensity, int brightness){
int staticCycle(int dev_number, static_commands_set *s, int intensity, int brightness){
unsigned char brgt;
switch (brightness){
case 0:
brgt = 0x1a;
@ -559,12 +595,11 @@ int cycle(int intensity, int brightness){
brgt = 0xff;
break;
default:
printf("Brightness must be defined in range of 0..4\n");
printf("Brightness must be in range of 0..4\n");
return 1;
}
unsigned char *I;
switch (intensity){
case 0:
I = (unsigned char [4]) { 0x78, 0x05, 0xb0, 0x04 }; // 7805b004
@ -582,54 +617,45 @@ int cycle(int intensity, int brightness){
I = (unsigned char [4]) { 0x90, 0x01, 0xc8, 0x00 }; // 9001c800
break;
default:
printf("Intensity must be defined in range of 0..4\n");
printf("Intensity must be in range of 0..4\n");
return 1;
}
counter = 0;
limit = 7;
//cc2204000000000000000004__00fd00fe0000000000________0000000007
unsigned char dir1[64] = { 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, brgt, 0x00, 0xfd, 0x00,
switch (dev_number){
case 1: //cc 22 04 00 00 00 00 00 00 00 00 04 __ 00 fd 00 fe 00 00 00 00 00 __ __ __ __ 00 00 00 00 07
s->name1 = EFFECT_CYCLE;
s->dir1 = (unsigned char [64]){ 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, brgt, 0x00, 0xfd, 0x00,
0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], 0x00, 0x00, 0x00, 0x00, 0x07, };
//cc2410000000000000000004__00fd00fe0000000000________0000000007
unsigned char dir2[64] = { 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, brgt, 0x00, 0xfd, 0x00,
break;
case 2: //cc 24 10 00 00 00 00 00 00 00 00 04 __ 00 fd 00 fe 00 00 00 00 00 __ __ __ __ 00 00 00 00 07
s->name2 = EFFECT_CYCLE;
s->dir2 = (unsigned char [64]){ 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, brgt, 0x00, 0xfd, 0x00,
0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], 0x00, 0x00, 0x00, 0x00, 0x07, };
//cc2520000000000000000004__00fd00fe0000000000________0000000007
unsigned char dir3[64] = { 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, brgt, 0x00, 0xfd, 0x00,
break;
case 3: //cc 25 20 00 00 00 00 00 00 00 00 04 __ 00 fd 00 fe 00 00 00 00 00 __ __ __ __ 00 00 00 00 07
s->name3 = EFFECT_CYCLE;
s->dir3 = (unsigned char [64]){ 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, brgt, 0x00, 0xfd, 0x00,
0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], 0x00, 0x00, 0x00, 0x00, 0x07, };
//cc2640000000000000000004__00fd00fe0000000000________0000000007
unsigned char dir4[64] = { 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, brgt, 0x00, 0xfd, 0x00,
break;
case 4: //cc 26 40 00 00 00 00 00 00 00 00 04 __ 00 fd 00 fe 00 00 00 00 00 __ __ __ __ 00 00 00 00 07
s->name4 = EFFECT_CYCLE;
s->dir4 = (unsigned char [64]){ 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, brgt, 0x00, 0xfd, 0x00,
0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], 0x00, 0x00, 0x00, 0x00, 0x07, };
//cc2780000000000000000004__00fd00fe0000000000________0000000007
unsigned char dir5[64] = { 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, brgt, 0x00, 0xfd, 0x00,
break;
case 5: //cc 27 80 00 00 00 00 00 00 00 00 04 __ 00 fd 00 fe 00 00 00 00 00 __ __ __ __ 00 00 00 00 07
s->name5 = EFFECT_CYCLE;
s->dir5 = (unsigned char [64]){ 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, brgt, 0x00, 0xfd, 0x00,
0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], 0x00, 0x00, 0x00, 0x00, 0x07, };
//cc9100020000000000000004__00fd00fe0000000000________0000000007
unsigned char dir6[64] = { 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, brgt, 0x00, 0xfd, 0x00,
break;
case 6: //cc 91 00 02 00 00 00 00 00 00 00 04 __ 00 fd 00 fe 00 00 00 00 00 __ __ __ __ 00 00 00 00 07
s->name6 = EFFECT_CYCLE;
s->dir6 = (unsigned char [64]){ 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, brgt, 0x00, 0xfd, 0x00,
0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, I[0], I[1], I[2], I[3], 0x00, 0x00, 0x00, 0x00, 0x07, };
if(64 != writeUsb(dir1))
break;
default:
printf("Device number must be in range of 1..6\n");
return 1;
if(64 != writeUsb(dir2))
return 1;
if(64 != writeUsb(dir3))
return 1;
if(64 != writeUsb(dir4))
return 1;
if(64 != writeUsb(dir5))
return 1;
if(64 != writeUsb(dir6))
return 1;
if(64 != writeUsb(end_transaction))
return 1;
printf("Impulse (Separate) applied\n");
}
return 0;
}