View Full Version : bug fix for core function for Teensy 2.0++ in Teensyduino 1.14rc3

05-26-2013, 07:23 PM
This bug would probably only be noticed if you were using digital functions on analog pins with Firmata or OSC:

in pins_arduino.h

#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
//#define analogInputToDigitalPin(ch) ((ch) <= 7 ? (ch) - 38 : -1)
#define analogInputToDigitalPin(ch) ((ch) <= 7 ? 38-(ch) : -1)

05-26-2013, 08:39 PM
Oh, yes, this is a bug. Thanks.

Are you sure that's the right fix? Seems like it ought to be

#define analogInputToDigitalPin(ch) ((ch) <= 7 ? 38+(ch) : -1)

05-26-2013, 08:50 PM
Your fix is correct.
My way of testing my "fix" was flawed. ;-)
Too many pins with so many functions on too many boards on too many platforms! You are prompting me to go back
and check my Leonardo OSC code because I had to provide my own analogInputToDigitalPin(ch) where there wasn't one.