Skip to content

Commit 24928f9

Browse files
committed
πŸ§‘β€πŸ’» FastIO AT90USB pins 46-47
1 parent 1e009c2 commit 24928f9

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

β€ŽMarlin/src/HAL/AVR/fastio/fastio_AT90USB.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,11 @@
363363
#define AIO7_PWM 0
364364
#define AIO7_DDR DDRF
365365

366-
//-- Begin not supported by Teensyduino
367-
//-- don't use Arduino functions on these pins pinMode/digitalWrite/etc
366+
//-- 46-47 are not supported by Teensyduino
367+
//-- Don't use Arduino functions (pinMode, digitalWrite, etc.) on these pins
368+
#define PIN_E2 46
369+
#define PIN_E3 47
370+
368371
#define DIO46_PIN PINE2
369372
#define DIO46_RPORT PINE
370373
#define DIO46_WPORT PORTE
@@ -377,10 +380,7 @@
377380
#define DIO47_PWM 0
378381
#define DIO47_DDR DDRE
379382

380-
#define TEENSY_E2 46
381-
#define TEENSY_E3 47
382-
383-
//-- end not supported by Teensyduino
383+
//--
384384

385385
#undef PA0
386386
#define PA0_PIN PINA0

β€ŽMarlin/src/HAL/AVR/pinsDebug.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,16 +377,16 @@ void printPinPort(const pin_t pin) { // print port number
377377
uint8_t x;
378378
SERIAL_ECHOPGM(" Port: ");
379379
#if AVR_AT90USB1286_FAMILY
380-
x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64;
380+
x = (pin == PIN_E2 || pin == PIN_E3) ? 'E' : 'A' + digitalPinToPort_DEBUG(pin) - 1;
381381
#else
382-
x = digitalPinToPort_DEBUG(pin) + 64;
382+
x = 'A' + digitalPinToPort_DEBUG(pin) - 1;
383383
#endif
384384
SERIAL_CHAR(x);
385385

386386
#if AVR_AT90USB1286_FAMILY
387-
if (pin == 46)
387+
if (pin == PIN_E2)
388388
x = '2';
389-
else if (pin == 47)
389+
else if (pin == PIN_E3)
390390
x = '3';
391391
else {
392392
uint8_t temp = digitalPinToBitMask_DEBUG(pin);

β€ŽMarlin/src/gcode/config/M43.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,20 @@ inline void toggle_pins() {
7979
#endif
8080
);
8181
#if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO
82-
if (pin == TEENSY_E2) {
83-
SET_OUTPUT(TEENSY_E2);
82+
if (pin == PIN_E2) {
83+
SET_OUTPUT(PIN_E2);
8484
for (int16_t j = 0; j < repeat; j++) {
85-
WRITE(TEENSY_E2, LOW); safe_delay(wait);
86-
WRITE(TEENSY_E2, HIGH); safe_delay(wait);
87-
WRITE(TEENSY_E2, LOW); safe_delay(wait);
85+
WRITE(PIN_E2, LOW); safe_delay(wait);
86+
WRITE(PIN_E2, HIGH); safe_delay(wait);
87+
WRITE(PIN_E2, LOW); safe_delay(wait);
8888
}
8989
}
90-
else if (pin == TEENSY_E3) {
91-
SET_OUTPUT(TEENSY_E3);
90+
else if (pin == PIN_E3) {
91+
SET_OUTPUT(PIN_E3);
9292
for (int16_t j = 0; j < repeat; j++) {
93-
WRITE(TEENSY_E3, LOW); safe_delay(wait);
94-
WRITE(TEENSY_E3, HIGH); safe_delay(wait);
95-
WRITE(TEENSY_E3, LOW); safe_delay(wait);
93+
WRITE(PIN_E3, LOW); safe_delay(wait);
94+
WRITE(PIN_E3, HIGH); safe_delay(wait);
95+
WRITE(PIN_E3, LOW); safe_delay(wait);
9696
}
9797
}
9898
else

0 commit comments

Comments
Β (0)