Update of /cvsroot/pure-data/externals/hardware/arduino/Pd_firmware
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24414/Pd_firmware
Modified Files:
Pd_firmware.pde
Log Message:
ported to new Serial object API and added support for more analog ins for the ATMEGA168 boards
Index: Pd_firmware.pde
===================================================================
RCS file: /cvsroot/pure-data/externals/hardware/arduino/Pd_firmware/Pd_firmware.pde,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** Pd_firmware.pde 15 Sep 2006 05:22:51 -0000 1.18
--- Pd_firmware.pde 28 Oct 2006 19:33:24 -0000 1.19
***************
*** 40,48 ****
/*
! * TODO: add pulseIn functionality
* TODO: add software PWM for servos, etc (servo.h or pulse.h)
* TODO: redesign protocol to accomodate boards with more I/Os
* TODO:
! * TODO: add "outputMode all 0/1" command
* TODO: add cycle markers to mark start of analog, digital, pulseIn, and PWM
*/
--- 40,48 ----
/*
! * TODO: add pulseOut functionality
* TODO: add software PWM for servos, etc (servo.h or pulse.h)
* TODO: redesign protocol to accomodate boards with more I/Os
* TODO:
! * TODO: add "pinMode all 0/1" command
* TODO: add cycle markers to mark start of analog, digital, pulseIn, and PWM
*/
***************
*** 59,63 ****
*/
! /* computer->Arduino commands
* -------------------- */
/* 128-129 // UNUSED */
--- 59,63 ----
*/
! /* computer<->Arduino commands
* -------------------- */
/* 128-129 // UNUSED */
***************
*** 87,90 ****
--- 87,93 ----
#define FIVE_ANALOG_INS 165 // enable reporting for 5 analog ins (0-4)
#define SIX_ANALOG_INS 166 // enable reporting for 6 analog ins (0-5)
+ #define SEVEN_ANALOG_INS 167 // enable reporting for 6 analog ins (0-6)
+ #define EIGHT_ANALOG_INS 168 // enable reporting for 6 analog ins (0-7)
+ #define NINE_ANALOG_INS 169 // enable reporting for 6 analog ins (0-8)
/* 167-199 // UNUSED */
#define SET_PIN_ZERO_TO_OUT 200 // set digital pin 0 to OUTPUT
***************
*** 138,142 ****
/* analog input message format
* ----------------------
! * 0 analog input marker
* 1 high byte from analog input pin 0
* 2 low byte from analog input pin 0
--- 141,145 ----
/* analog input message format
* ----------------------
! * 0 analog input marker (160 + number of pins to report)
* 1 high byte from analog input pin 0
* 2 low byte from analog input pin 0
***************
*** 271,277 ****
*/
void checkForInput() {
! if(serialAvailable()) {
! while(serialAvailable()) {
! processInput( (byte)serialRead() );
}
}
--- 274,280 ----
*/
void checkForInput() {
! if(Serial.available()) {
! while(Serial.available()) {
! processInput( (byte)Serial.read() );
}
}
***************
*** 383,388 ****
case FIVE_ANALOG_INS: // analog 0-4 on
case SIX_ANALOG_INS: // analog 0-5 on
! analogInputsEnabled = inputData - ZERO_ANALOG_INS;
! break;
case ENABLE_PWM:
waitForData = 2; // 2 bytes needed (pin#, dutyCycle)
--- 386,394 ----
case FIVE_ANALOG_INS: // analog 0-4 on
case SIX_ANALOG_INS: // analog 0-5 on
! case SEVEN_ANALOG_INS: // analog 0-6 on
! case EIGHT_ANALOG_INS: // analog 0-7 on
! case NINE_ANALOG_INS: // analog 0-8 on
! analogInputsEnabled = inputData - ZERO_ANALOG_INS;
! break;
case ENABLE_PWM:
waitForData = 2; // 2 bytes needed (pin#, dutyCycle)
***************
*** 424,428 ****
byte i;
! beginSerial(19200);
for(i=0; i<TOTAL_DIGITAL_PINS; ++i) {
setPinMode(i,INPUT);
--- 430,434 ----
byte i;
! Serial.begin(19200);
for(i=0; i<TOTAL_DIGITAL_PINS; ++i) {
setPinMode(i,INPUT);