Commit f238d407 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Handle more than 7 channels

parent 64da2a2f
...@@ -73,60 +73,48 @@ void *Reader(void *argument) { ...@@ -73,60 +73,48 @@ void *Reader(void *argument) {
// Currently unused // Currently unused
} break; } break;
} }
} else { } else if (channel < 31) {
switch (channel) { printf("I%d=%3d ", channel, value);
case 0:{ printf("I0=%3d ", value); } break; } else if (channel == 31) {
case 1:{ printf("I1=%3d ", value); } break; int kind = (value>>5)& 0x7;
case 2:{ printf("I2=%3d ", value); } break; int cmd = (value>>8)& 0x3;
case 3:{ printf("I3=%3d ", value); } break; int conf_channel = value & 0x1f;
case 4:{ printf("I4=%3d ", value); } break; int *maxdata = 0;
case 5:{ printf("I5=%3d ", value); } break; switch(kind) {
case 6:{ printf("I6=%3d ", value); } break; case 1: {
case 31:{ printf("digital in ");
int kind = (value>>5)& 0x7; digital_in |= 1 << conf_channel;
int cmd = (value>>8)& 0x3; } break;
int conf_channel = value & 0x1f; case 2: {
int *maxdata = 0; printf("digital out ");
switch(kind) { digital_out |= 1 << conf_channel;
case 1: { } break;
printf("digital in "); case 3: {
digital_in |= 1 << conf_channel; printf("analog in ");
} break; analog_in |= 1 << conf_channel;
case 2: { maxdata = &maxdata_in[conf_channel];
printf("digital out "); } break;
digital_out |= 1 << conf_channel; case 4: {
} break; printf("analog out ");
case 3: { analog_out |= 1 << conf_channel;
printf("analog in "); maxdata = &maxdata_out[conf_channel];
analog_in |= 1 << conf_channel; } break;
maxdata = &maxdata_in[conf_channel]; case 5: {
} break; printf("encoder in ");
case 4: { encoder_in |= 1 << conf_channel;
printf("analog out "); maxdata = &maxdata_in[conf_channel];
analog_out |= 1 << conf_channel; } break;
maxdata = &maxdata_out[conf_channel]; }
} break; printf("#%d ", conf_channel);
case 5: { switch (cmd) {
printf("encoder in "); case 0: {
encoder_in |= 1 << conf_channel; printf("maxdata %d\n", (1<<(value>>10))-1);
maxdata = &maxdata_in[conf_channel]; if (maxdata) { *maxdata = (1<<(value>>10))-1; }
} break; } break;
} case 1: { printf("min %d\n", millivolts(value>>10)); } break;
printf("#%d ", conf_channel); case 2: { printf("max %d\n", millivolts(value>>10)); } break;
switch (cmd) { default: { printf("cmd %d %d\n", cmd, (value>>10)); } break;
case 0: { }
printf("maxdata %d\n", (1<<(value>>10))-1);
if (maxdata) { *maxdata = (1<<(value>>10))-1; }
} break;
case 1: { printf("min %d\n", millivolts(value>>10)); } break;
case 2: { printf("max %d\n", millivolts(value>>10)); } break;
default: { printf("cmd %d %d\n", cmd, (value>>10)); } break;
}
} break;
default: {
printf("%d=%x (%d)\n", channel, value, length);
} break;
}
} }
value = 0; value = 0;
length = 0; length = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment