diff --git a/megaavr/variants/txy2/pins_arduino.h b/megaavr/variants/txy2/pins_arduino.h index 7250d1c5..b5b2fc27 100644 --- a/megaavr/variants/txy2/pins_arduino.h +++ b/megaavr/variants/txy2/pins_arduino.h @@ -40,10 +40,12 @@ #define digitalPinHasPWM(p) ((p) != 0 && (p) != 5) +#ifdef PORTMUX_SPI0_bm #define PIN_SPI_MISO_PINSWAP_1 (1) #define PIN_SPI_SCK_PINSWAP_1 (4) #define PIN_SPI_MOSI_PINSWAP_1 (0) #define PIN_SPI_SS_PINSWAP_1 (0) +#endif #define PIN_SPI_MISO (3) #define PIN_SPI_SCK (4) #define PIN_SPI_MOSI (2) diff --git a/megaavr/variants/txy4/pins_arduino.h b/megaavr/variants/txy4/pins_arduino.h index 51cac7c2..692673c7 100644 --- a/megaavr/variants/txy4/pins_arduino.h +++ b/megaavr/variants/txy4/pins_arduino.h @@ -49,8 +49,10 @@ +#ifdef PORTMUX_TWI0_bm #define PIN_WIRE_SDA_PINSWAP_1 (8) #define PIN_WIRE_SCL_PINSWAP_1 (9) +#endif #define PIN_WIRE_SDA (6) #define PIN_WIRE_SCL (7) diff --git a/megaavr/variants/txy6/pins_arduino.h b/megaavr/variants/txy6/pins_arduino.h index f8d7fe36..8832f2dc 100644 --- a/megaavr/variants/txy6/pins_arduino.h +++ b/megaavr/variants/txy6/pins_arduino.h @@ -47,18 +47,22 @@ #define PIN_SPI_SCK (16) #define PIN_SPI_MOSI (14) #define PIN_SPI_SS (0) +#ifdef PORTMUX_SPI0_bm #define PIN_SPI_MISO_PINSWAP_1 (11) #define PIN_SPI_SCK_PINSWAP_1 (10) #define PIN_SPI_MOSI_PINSWAP_1 (12) #define PIN_SPI_SS_PINSWAP_1 (13) +#endif #define SPI_INTERFACES_COUNT 1 -#define PIN_WIRE_SDA (14) -#define PIN_WIRE_SCL (15) -#define PIN_WIRE_SDA_PINSWAP_1 (8) -#define PIN_WIRE_SCL_PINSWAP_1 (9) +#define PIN_WIRE_SDA (8) +#define PIN_WIRE_SCL (9) +#ifdef PORTMUX_TWI0_bm +#define PIN_WIRE_SDA_PINSWAP_1 (14) +#define PIN_WIRE_SCL_PINSWAP_1 (15) +#endif //Define the pin names, since user code may depend on them, even though the core libraries don't... diff --git a/megaavr/variants/txy7/pins_arduino.h b/megaavr/variants/txy7/pins_arduino.h index ea6b5dee..ff7b022b 100644 --- a/megaavr/variants/txy7/pins_arduino.h +++ b/megaavr/variants/txy7/pins_arduino.h @@ -41,10 +41,12 @@ #define digitalPinHasPWM(p) ((p) == 0 || (p) == 1 || (p) == 11 || (p) == 10 || (p) == 9 || (p) == 20) #endif +#ifdef PORTMUX_SPI0_bm #define PIN_SPI_MISO_PINSWAP_1 (13) #define PIN_SPI_SCK_PINSWAP_1 (12) #define PIN_SPI_MOSI_PINSWAP_1 (14) #define PIN_SPI_SS_PINSWAP_1 (15) +#endif #define PIN_SPI_MISO (19) #define PIN_SPI_SCK (20) #define PIN_SPI_MOSI (18) @@ -52,8 +54,10 @@ #define SPI_INTERFACES_COUNT 1 +#ifdef PORTMUX_TWI0_bm #define PIN_WIRE_SDA_PINSWAP_1 (18) #define PIN_WIRE_SCL_PINSWAP_1 (19) +#endif #define PIN_WIRE_SDA (10) #define PIN_WIRE_SCL (11)