From 1fa7b8cd8d0f04b0332dd242283c57caf600d103 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Fri, 29 Jan 2021 17:48:59 +0100 Subject: [PATCH] Move SDA/SCL pins into pins.h for fastio compatibility fastio relies on macros for pin definitions, so we cannot use the const declaration in Sd2PinMap or the arduino's definition. Declare SDA/SCL_PIN into pins.h based on the current MCU, which is identical in all our variants. Remove the conflicting/unused declaration in Sd2PinMap. --- Firmware/Sd2PinMap.h | 6 +----- Firmware/pins.h | 5 +++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Firmware/Sd2PinMap.h b/Firmware/Sd2PinMap.h index 8a608731..da50958f 100644 --- a/Firmware/Sd2PinMap.h +++ b/Firmware/Sd2PinMap.h @@ -37,10 +37,6 @@ struct pin_map_t { || defined(__AVR_ATmega2560__) // Mega -// Two Wire (aka I2C) ports -uint8_t const SDA_PIN = 20; // D1 -uint8_t const SCL_PIN = 21; // D0 - #undef MOSI_PIN #undef MISO_PIN // SPI port @@ -365,4 +361,4 @@ static inline __attribute__((always_inline)) #endif // Sd2PinMap_h -#endif \ No newline at end of file +#endif diff --git a/Firmware/pins.h b/Firmware/pins.h index 5d3b4f83..1c20a001 100644 --- a/Firmware/pins.h +++ b/Firmware/pins.h @@ -25,6 +25,11 @@ #error Unknown MOTHERBOARD value in configuration.h #endif +#if !defined(SDA_PIN) && (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)) +#define SDA_PIN 20 +#define SCL_PIN 21 +#endif + //List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those! #define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, HEATER_0_PIN, #if EXTRUDERS > 1