From 98e96feee9062d7e52ad5b240091a974faf1e394 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Sat, 6 Aug 2016 15:21:23 +0200 Subject: [PATCH] Repair SPI-pins SCK_PIN can't be defined as DIO[number] they mus be defined as pure number. So rebuilding the structure of fastio.h in pins.h. --- Marlin/pins.h | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/Marlin/pins.h b/Marlin/pins.h index 3657675db..c040805b6 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -456,17 +456,56 @@ #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) +/** + * Define SPI Pins: SCK, MISO, MOSI, SS + */ +#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__) + #define AVR_SCK_PIN 13 + #define AVR_MISO_PIN 12 + #define AVR_MOSI_PIN 11 + #define AVR_SS_PIN 10 +#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__) + #define AVR_SCK_PIN 7 + #define AVR_MISO_PIN 6 + #define AVR_MOSI_PIN 5 + #define AVR_SS_PIN 4 +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) + #define AVR_SCK_PIN 52 + #define AVR_MISO_PIN 50 + #define AVR_MOSI_PIN 51 + #define AVR_SS_PIN 53 +#elif defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) + #if ENABLED(AT90USBxx_TEENSYPP_ASSIGNMENTS) + // Teensy pin assignments + #define AVR_SCK_PIN 21 + #define AVR_MISO_PIN 23 + #define AVR_MOSI_PIN 22 + #define AVR_SS_PIN 20 + #else + // Traditional pin assignments + #define AVR_SCK_PIN 9 + #define AVR_MISO_PIN 11 + #define AVR_MOSI_PIN 10 + #define AVR_SS_PIN 8 + #endif +#elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) + #define AVR_SCK_PIN 10 + #define AVR_MISO_PIN 12 + #define AVR_MOSI_PIN 11 + #define AVR_SS_PIN 16 +#endif + #ifndef SCK_PIN - #define SCK_PIN SCK + #define SCK_PIN AVR_SCK_PIN #endif #ifndef MISO_PIN - #define MISO_PIN MISO + #define MISO_PIN AVR_MISO_PIN #endif #ifndef MOSI_PIN - #define MOSI_PIN MOSI + #define MOSI_PIN AVR_MOSI_PIN #endif #ifndef SS_PIN - #define SS_PIN SS + #define SS_PIN AVR_SS_PIN #endif #endif //__PINS_H