Browse Source

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.
AnHardt 8 years ago
parent
commit
98e96feee9
1 changed files with 43 additions and 4 deletions
  1. 43
    4
      Marlin/pins.h

+ 43
- 4
Marlin/pins.h View File

@@ -456,17 +456,56 @@
456 456
 
457 457
 #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
458 458
 
459
+/**
460
+ * Define SPI Pins: SCK, MISO, MOSI, SS
461
+ */
462
+#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__)
463
+  #define AVR_SCK_PIN  13
464
+  #define AVR_MISO_PIN 12
465
+  #define AVR_MOSI_PIN 11
466
+  #define AVR_SS_PIN   10
467
+#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__)
468
+  #define AVR_SCK_PIN  7
469
+  #define AVR_MISO_PIN 6
470
+  #define AVR_MOSI_PIN 5
471
+  #define AVR_SS_PIN   4
472
+#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
473
+  #define AVR_SCK_PIN  52
474
+  #define AVR_MISO_PIN 50
475
+  #define AVR_MOSI_PIN 51
476
+  #define AVR_SS_PIN   53
477
+#elif defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__)
478
+  #if ENABLED(AT90USBxx_TEENSYPP_ASSIGNMENTS)
479
+    // Teensy pin assignments
480
+    #define AVR_SCK_PIN  21
481
+    #define AVR_MISO_PIN 23
482
+    #define AVR_MOSI_PIN 22
483
+    #define AVR_SS_PIN   20
484
+  #else
485
+    // Traditional pin assignments
486
+    #define AVR_SCK_PIN  9
487
+    #define AVR_MISO_PIN 11
488
+    #define AVR_MOSI_PIN 10
489
+    #define AVR_SS_PIN   8
490
+  #endif
491
+#elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
492
+  #define AVR_SCK_PIN  10
493
+  #define AVR_MISO_PIN 12
494
+  #define AVR_MOSI_PIN 11
495
+  #define AVR_SS_PIN   16
496
+#endif
497
+
459 498
 #ifndef SCK_PIN
460
-  #define SCK_PIN  SCK
499
+  #define SCK_PIN  AVR_SCK_PIN
461 500
 #endif
462 501
 #ifndef MISO_PIN
463
-  #define MISO_PIN MISO
502
+  #define MISO_PIN AVR_MISO_PIN
464 503
 #endif
465 504
 #ifndef MOSI_PIN
466
-  #define MOSI_PIN MOSI
505
+  #define MOSI_PIN AVR_MOSI_PIN
467 506
 #endif
468 507
 #ifndef SS_PIN
469
-  #define SS_PIN   SS
508
+  #define SS_PIN   AVR_SS_PIN
470 509
 #endif
471 510
 
472 511
 #endif //__PINS_H

Loading…
Cancel
Save