Update of /cvsroot/pure-data/externals/hardware/arduino/Pd_firmware In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10826/Pd_firmware
Modified Files: Pd_firmware.pde Log Message: all outputs seem to be working, now its time to test all of the inputs; cleaned up some cruft too
Index: Pd_firmware.pde =================================================================== RCS file: /cvsroot/pure-data/externals/hardware/arduino/Pd_firmware/Pd_firmware.pde,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Pd_firmware.pde 20 May 2006 15:29:48 -0000 1.4 --- Pd_firmware.pde 20 May 2006 15:50:48 -0000 1.5 *************** *** 147,154 **** // ------------------------------------------------------------------------- void processInput(byte inputData) { ! byte i; int mask; - // byte writeTest; - // byte highDigitalPinStatus;
// the PWM commands (230-232) have a byte of data following the command --- 147,152 ---- // ------------------------------------------------------------------------- void processInput(byte inputData) { ! int i; int mask;
// the PWM commands (230-232) have a byte of data following the command *************** *** 159,182 **** waitForPWMData = 0; } ! 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); ! } */ } firstInputByte = false; --- 157,173 ---- waitForPWMData = 0; } ! else if(inputData < 128) { printByte(151); if(firstInputByte) { printByte(160); for(i=0; i<7; ++i) { mask = 1 << i; ! //printByte(254); ! //printByte(i); ! //printByte(mask); ! if(digitalPinStatus & mask) { ! digitalWrite(i, inputData & mask); ! //printByte(inputData & mask); ! } } firstInputByte = false; *************** *** 184,201 **** 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 if( (digitalPinStatus & mask) && !(pwmStatus & mask) ) { digitalWrite(i, inputData & (mask >> 7)); ! printByte(inputData & (mask >> 7)); ! // printByte(highDigitalPinStatus & mask); } } --- 175,188 ---- else { printByte(161); // output data for pins 7-13 for(i=7; i<TOTAL_DIGITAL_PINS; ++i) { mask = 1 << i; ! //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)); } }