diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2006-05-20 15:50:48 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2006-05-20 15:50:48 +0000 |
commit | d034240b67b12ecd43299eb012c9c55acd3d3150 (patch) | |
tree | 4a17ea8d2c6c5c444fec076e445734012ae0f2ad /Pd_firmware/Pd_firmware.pde | |
parent | 1deea59ab7d556b9675fc247c3c2a58a120419e7 (diff) |
all outputs seem to be working, now its time to test all of the inputs; cleaned up some cruft too
svn path=/trunk/externals/hardware/arduino/; revision=5095
Diffstat (limited to 'Pd_firmware/Pd_firmware.pde')
-rw-r--r-- | Pd_firmware/Pd_firmware.pde | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/Pd_firmware/Pd_firmware.pde b/Pd_firmware/Pd_firmware.pde index 2f703cd..6265f26 100644 --- a/Pd_firmware/Pd_firmware.pde +++ b/Pd_firmware/Pd_firmware.pde @@ -146,10 +146,8 @@ void checkForInput() { // -------------------------------------------------------------------------
void processInput(byte inputData) {
- byte i;
+ int i;
int mask;
-// byte writeTest;
-// byte highDigitalPinStatus;
// the PWM commands (230-232) have a byte of data following the command
if (waitForPWMData > 0) {
@@ -158,45 +156,34 @@ void processInput(byte inputData) { analogWrite(waitForPWMData,inputData);
waitForPWMData = 0;
}
- else if(inputData < 128) {
+ else if(inputData < 128) {
printByte(151);
if(firstInputByte) {
printByte(160);
- printByte(inputData);
- // TODO: this section is for digital out...
for(i=0; i<7; ++i) {
mask = 1 << i;
-/* writeTest = digitalPinStatus;
-// writeTest = writeTest & mask;
-// printByte(writeTest);
-// if(writeTest) {
-// or
-/* if((byte)digitalPinStatus & mask) {
-// digitalWrite(i,(inputData & mask) >> i);
- printByte(254);
- printByte(i);
- printByte(mask);
- printByte(inputData & mask);
- } */
+ //printByte(254);
+ //printByte(i);
+ //printByte(mask);
+ if(digitalPinStatus & mask) {
+ digitalWrite(i, inputData & mask);
+ //printByte(inputData & mask);
+ }
}
firstInputByte = false;
}
else {
printByte(161);
- printByte(inputData);
// output data for pins 7-13
- //highDigitalPinStatus = digitalPinStatus >> 7;
for(i=7; i<TOTAL_DIGITAL_PINS; ++i) {
mask = 1 << i;
- printByte(254);
- printByte(i);
- printByte(mask);
-// if(digitalPinStatus & mask) {
-// need to add test for pwmStatus
+ //printByte(254);
+ //printByte(i);
+ //printByte(mask);
if( (digitalPinStatus & mask) && !(pwmStatus & mask) ) {
+ // inputData is a byte and mask is an int, so align the high part of mask
digitalWrite(i, inputData & (mask >> 7));
- printByte(inputData & (mask >> 7));
-// printByte(highDigitalPinStatus & mask);
+ //printByte(inputData & (mask >> 7));
}
}
}
|