🧑‍💻 FastIO AT90USB pins 46-47

This commit is contained in:
Scott Lahteine 2025-04-21 19:59:41 -05:00
parent 1e009c2aa5
commit 24928f93ba
3 changed files with 20 additions and 20 deletions

View file

@ -363,8 +363,11 @@
#define AIO7_PWM 0 #define AIO7_PWM 0
#define AIO7_DDR DDRF #define AIO7_DDR DDRF
//-- Begin not supported by Teensyduino //-- 46-47 are not supported by Teensyduino
//-- don't use Arduino functions on these pins pinMode/digitalWrite/etc //-- Don't use Arduino functions (pinMode, digitalWrite, etc.) on these pins
#define PIN_E2 46
#define PIN_E3 47
#define DIO46_PIN PINE2 #define DIO46_PIN PINE2
#define DIO46_RPORT PINE #define DIO46_RPORT PINE
#define DIO46_WPORT PORTE #define DIO46_WPORT PORTE
@ -377,10 +380,7 @@
#define DIO47_PWM 0 #define DIO47_PWM 0
#define DIO47_DDR DDRE #define DIO47_DDR DDRE
#define TEENSY_E2 46 //--
#define TEENSY_E3 47
//-- end not supported by Teensyduino
#undef PA0 #undef PA0
#define PA0_PIN PINA0 #define PA0_PIN PINA0

View file

@ -377,16 +377,16 @@ void printPinPort(const pin_t pin) { // print port number
uint8_t x; uint8_t x;
SERIAL_ECHOPGM(" Port: "); SERIAL_ECHOPGM(" Port: ");
#if AVR_AT90USB1286_FAMILY #if AVR_AT90USB1286_FAMILY
x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64; x = (pin == PIN_E2 || pin == PIN_E3) ? 'E' : 'A' + digitalPinToPort_DEBUG(pin) - 1;
#else #else
x = digitalPinToPort_DEBUG(pin) + 64; x = 'A' + digitalPinToPort_DEBUG(pin) - 1;
#endif #endif
SERIAL_CHAR(x); SERIAL_CHAR(x);
#if AVR_AT90USB1286_FAMILY #if AVR_AT90USB1286_FAMILY
if (pin == 46) if (pin == PIN_E2)
x = '2'; x = '2';
else if (pin == 47) else if (pin == PIN_E3)
x = '3'; x = '3';
else { else {
uint8_t temp = digitalPinToBitMask_DEBUG(pin); uint8_t temp = digitalPinToBitMask_DEBUG(pin);

View file

@ -79,20 +79,20 @@ inline void toggle_pins() {
#endif #endif
); );
#if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO #if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO
if (pin == TEENSY_E2) { if (pin == PIN_E2) {
SET_OUTPUT(TEENSY_E2); SET_OUTPUT(PIN_E2);
for (int16_t j = 0; j < repeat; j++) { for (int16_t j = 0; j < repeat; j++) {
WRITE(TEENSY_E2, LOW); safe_delay(wait); WRITE(PIN_E2, LOW); safe_delay(wait);
WRITE(TEENSY_E2, HIGH); safe_delay(wait); WRITE(PIN_E2, HIGH); safe_delay(wait);
WRITE(TEENSY_E2, LOW); safe_delay(wait); WRITE(PIN_E2, LOW); safe_delay(wait);
} }
} }
else if (pin == TEENSY_E3) { else if (pin == PIN_E3) {
SET_OUTPUT(TEENSY_E3); SET_OUTPUT(PIN_E3);
for (int16_t j = 0; j < repeat; j++) { for (int16_t j = 0; j < repeat; j++) {
WRITE(TEENSY_E3, LOW); safe_delay(wait); WRITE(PIN_E3, LOW); safe_delay(wait);
WRITE(TEENSY_E3, HIGH); safe_delay(wait); WRITE(PIN_E3, HIGH); safe_delay(wait);
WRITE(TEENSY_E3, LOW); safe_delay(wait); WRITE(PIN_E3, LOW); safe_delay(wait);
} }
} }
else else