From e3592e6db4e34b4eb5b1aecfc42ba6a9f165893c Mon Sep 17 00:00:00 2001 From: Defragster Date: Thu, 14 Sep 2023 22:08:10 -0700 Subject: [PATCH] analogInputToDigitalPin for 1062's Returns -1 and wrong values Edited macro analogInputToDigitalPin based on this https://forum.pjrc.com/threads/73526-Bug-in-Teensyduino-1-58-for-analogInputToDigitalPin()?p=331675&viewfull=1#post331675 --- teensy4/pins_arduino.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/teensy4/pins_arduino.h b/teensy4/pins_arduino.h index a6d5b32db..f387e4aeb 100644 --- a/teensy4/pins_arduino.h +++ b/teensy4/pins_arduino.h @@ -108,15 +108,15 @@ static const uint8_t SCL = 19; #if defined(__IMXRT1062__) && defined(ARDUINO_TEENSY40) - #define analogInputToDigitalPin(p) (((p) <= 9) ? (p) + 14 : (( ((p) >= 14 && (p) <= 27)) ? (p) : -1)) + #define analogInputToDigitalPin(p) (((p) <= 13) ? (p) + 14 : -1) #define digitalPinHasPWM(p) ((p) <= 15 || (p) == 18 || (p) == 19 || ((p) >= 22 && (p) <= 25) || (p) == 28 || (p) == 29 || ((p) >= 33 && (p) <= 39)) #elif defined(__IMXRT1062__) && defined(ARDUINO_TEENSY41) - #define analogInputToDigitalPin(p) (((p) <= 9) ? (p) + 14 : (( ((p) >= 14 && (p) <= 27)) || ((p) >= 38 && (p) <= 41) ? (p) : -1)) + #define analogInputToDigitalPin(p) (((p) <= 13) ? (p) + 14 : (( ((p) >= 14 && (p) <= 17)) ? (p) + 24 : -1)) #define digitalPinHasPWM(p) ((p) <= 15 || (p) == 18 || (p) == 19 || ((p) >= 22 && (p) <= 25) || (p) == 28 || (p) == 29 || (p) == 33 || (p) == 36 || (p) == 37 || ((p) >= 42 && (p) <= 47) || (p) == 51 || (p) == 54) #elif defined(__IMXRT1062__) && defined(ARDUINO_TEENSY_MICROMOD) - #define analogInputToDigitalPin(p) (((p) <= 9) ? (p) + 14 : (( ((p) >= 14 && (p) <= 27)) ? (p) : -1)) + #define analogInputToDigitalPin(p) (((p) <= 13) ? (p) + 14 : -1) #define digitalPinHasPWM(p) ((p) <= 15 || (p) == 18 || (p) == 19 || ((p) >= 22 && (p) <= 25) || (p) == 28 || (p) == 29 || (p) == 33 || (p) == 40 || (p) == 41 || (p) == 45) #endif #define digitalPinToInterrupt(p) ((p) < NUM_DIGITAL_PINS ? (p) : -1)