bug fix for core function for Teensy 2.0++ in Teensyduino 1.14rc3

adrianfreed

Well-known member
This bug would probably only be noticed if you were using digital functions on analog pins with Firmata or OSC:

in pins_arduino.h

Code:
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
//#define analogInputToDigitalPin(ch)	((ch) <= 7 ? (ch) - 38 : -1)
#define analogInputToDigitalPin(ch)	((ch) <= 7 ? 38-(ch) : -1)
 
Oh, yes, this is a bug. Thanks.

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

Code:
#define analogInputToDigitalPin(ch)	((ch) <= 7 ? 38+(ch) : -1)
 
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.
 
Back
Top