瀏覽代碼

Merge pull request #8484 from Bob-the-Kuhn/P1.02-P1.20

2.0.x LPC1768 - M42 compatibility with Repetier Host
Scott Lahteine 7 年之前
父節點
當前提交
586c1e4e73
沒有連結到貢獻者的電子郵件帳戶。

+ 2
- 2
Marlin/src/HAL/HAL_AVR/HAL_pinsDebug_AVR.h 查看文件

@@ -58,7 +58,7 @@ void HAL_analog_pin_state(char buffer[], int8_t pin) {
58 58
 #define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
59 59
 
60 60
 #include "../../pins/pinsDebug_list.h"
61
-#line 51
61
+#line 62
62 62
 
63 63
 // manually add pins that have names that are macros which don't play well with these macros
64 64
 #if SERIAL_PORT == 0 && (AVR_ATmega2560_FAMILY || AVR_ATmega1284_FAMILY)
@@ -109,7 +109,7 @@ const PinInfo pin_array[] PROGMEM = {
109 109
   #endif
110 110
 
111 111
   #include "../../pins/pinsDebug_list.h"
112
-  #line 102
112
+  #line 113
113 113
 
114 114
 };
115 115
 

+ 1
- 1
Marlin/src/HAL/HAL_AVR/MarlinSerial.h 查看文件

@@ -32,7 +32,7 @@
32 32
 #ifndef _MARLINSERIAL_H_
33 33
 #define _MARLINSERIAL_H_
34 34
 
35
-#include "../../inc/MarlinConfig.h"
35
+#include "../../inc/MarlinConfigPre.h"
36 36
 
37 37
 #include <WString.h>
38 38
 

+ 7
- 7
Marlin/src/HAL/HAL_LPC1768/HAL.cpp 查看文件

@@ -174,12 +174,12 @@ uint16_t HAL_adc_get_result(void) {
174 174
 #define SBIT_PWMEN     2
175 175
 #define SBIT_PWMMR0R   1
176 176
 
177
-#define PWM_1          0  //P2_0 (0-1 Bits of PINSEL4)
178
-#define PWM_2          2  //P2_1 (2-3 Bits of PINSEL4)
179
-#define PWM_3          4  //P2_2 (4-5 Bits of PINSEL4)
180
-#define PWM_4          6  //P2_3 (6-7 Bits of PINSEL4)
181
-#define PWM_5          8  //P2_4 (8-9 Bits of PINSEL4)
182
-#define PWM_6          10 //P2_5 (10-11 Bits of PINSEL4)
177
+#define PWM_1          0  //P2_00 (0-1 Bits of PINSEL4)
178
+#define PWM_2          2  //P2_01 (2-3 Bits of PINSEL4)
179
+#define PWM_3          4  //P2_02 (4-5 Bits of PINSEL4)
180
+#define PWM_4          6  //P2_03 (6-7 Bits of PINSEL4)
181
+#define PWM_5          8  //P2_04 (8-9 Bits of PINSEL4)
182
+#define PWM_6          10 //P2_05 (10-11 Bits of PINSEL4)
183 183
 
184 184
 void HAL_pwm_init(void) {
185 185
   LPC_PINCON->PINSEL4 = _BV(PWM_5) | _BV(PWM_6);
@@ -193,7 +193,7 @@ void HAL_pwm_init(void) {
193 193
 
194 194
   // Trigger the latch Enable Bits to load the new Match Values MR0, MR5, MR6
195 195
   LPC_PWM1->LER = _BV(0) | _BV(5) | _BV(6);
196
-  // Enable the PWM output pins for PWM_5-PWM_6(P2_4 - P2_5)
196
+  // Enable the PWM output pins for PWM_5-PWM_6(P2_04 - P2_05)
197 197
   LPC_PWM1->PCR = _BV(13) | _BV(14);
198 198
 }
199 199
 

+ 2
- 6
Marlin/src/HAL/HAL_LPC1768/HAL_LCD_I2C_routines.h 查看文件

@@ -20,16 +20,12 @@
20 20
  *
21 21
  */
22 22
 
23
-#if defined(TARGET_LPC1768)
24
-
25
-   void u8g_i2c_init(uint8_t options);
23
+#ifdef TARGET_LPC1768
26 24
 
25
+  void u8g_i2c_init(uint8_t options);
27 26
   uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos);
28
-
29 27
   uint8_t u8g_i2c_start(uint8_t sla);
30
-
31 28
   uint8_t u8g_i2c_send_byte(uint8_t data);
32
-
33 29
   void u8g_i2c_stop(void);
34 30
 
35 31
 #endif

+ 39
- 42
Marlin/src/HAL/HAL_LPC1768/HAL_LCD_pin_routines.c 查看文件

@@ -30,34 +30,34 @@
30 30
  * resulted in using about about 25% of the CPU's time.
31 31
  */
32 32
 
33
-#if defined(TARGET_LPC1768)
33
+#ifdef TARGET_LPC1768
34 34
 
35
-  #include <LPC17xx.h>
36
-  #include <lpc17xx_pinsel.h>
37
-  #include "src/core/macros.h"
38
-//  #include "pinmapping.h"
35
+#include <LPC17xx.h>
36
+#include <lpc17xx_pinsel.h>
37
+#include "src/core/macros.h"
38
+//#include "pinmapping.h"
39 39
 
40
-  #define LPC_PORT_OFFSET         (0x0020)
41
-  #define LPC_PIN(pin)            (1UL << pin)
42
-  #define LPC_GPIO(port)          ((volatile LPC_GPIO_TypeDef *)(LPC_GPIO0_BASE + LPC_PORT_OFFSET * port))
40
+#define LPC_PORT_OFFSET         (0x0020)
41
+#define LPC_PIN(pin)            (1UL << pin)
42
+#define LPC_GPIO(port)          ((volatile LPC_GPIO_TypeDef *)(LPC_GPIO0_BASE + LPC_PORT_OFFSET * port))
43 43
 
44
-  #define INPUT 0
45
-  #define OUTPUT 1
46
-  #define INPUT_PULLUP 2
44
+#define INPUT 0
45
+#define OUTPUT 1
46
+#define INPUT_PULLUP 2
47 47
 
48 48
 
49 49
 uint8_t LPC1768_PIN_PORT(const uint8_t pin);
50 50
 uint8_t LPC1768_PIN_PIN(const uint8_t pin);
51 51
 
52
-  #ifdef __cplusplus
53
-      extern "C" {
54
-  #endif
52
+#ifdef __cplusplus
53
+    extern "C" {
54
+#endif
55 55
 
56
-// IO functions
56
+// I/O functions
57 57
 // As defined by Arduino INPUT(0x0), OUPUT(0x1), INPUT_PULLUP(0x2)
58 58
 void pinMode_LCD(uint8_t pin, uint8_t mode) {
59
-#define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
60
-#define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
59
+  #define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
60
+  #define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
61 61
   PINSEL_CFG_Type config = { LPC1768_PIN_PORT(pin),
62 62
                              LPC1768_PIN_PIN(pin),
63 63
                              PINSEL_FUNC_0,
@@ -82,35 +82,32 @@ void pinMode_LCD(uint8_t pin, uint8_t mode) {
82 82
   }
83 83
 }
84 84
 
85
+void u8g_SetPinOutput(uint8_t internal_pin_number) {
86
+   pinMode_LCD(internal_pin_number, 1);  // OUTPUT
87
+}
85 88
 
86
-  void u8g_SetPinOutput(uint8_t internal_pin_number) {
87
-     pinMode_LCD(internal_pin_number, 1);  // OUTPUT
88
-  }
89
-
90
-  void u8g_SetPinInput(uint8_t internal_pin_number) {
91
-     pinMode_LCD(internal_pin_number, 0);  // INPUT
92
-  }
89
+void u8g_SetPinInput(uint8_t internal_pin_number) {
90
+   pinMode_LCD(internal_pin_number, 0);  // INPUT
91
+}
93 92
 
93
+void u8g_SetPinLevel(uint8_t  pin, uint8_t  pin_status) {
94
+  #define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
95
+  #define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
96
+  if (pin_status)
97
+    LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOSET = LPC_PIN(LPC1768_PIN_PIN(pin));
98
+  else
99
+    LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOCLR = LPC_PIN(LPC1768_PIN_PIN(pin));
100
+}
94 101
 
102
+uint8_t u8g_GetPinLevel(uint8_t pin) {
103
+  #define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
104
+  #define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
105
+  return (uint32_t)LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOPIN & LPC_PIN(LPC1768_PIN_PIN(pin)) ? 1 : 0;
106
+}
95 107
 
96
-  void u8g_SetPinLevel(uint8_t  pin, uint8_t  pin_status) {
97
-#define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
98
-#define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
99
-    if (pin_status)
100
-      LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOSET = LPC_PIN(LPC1768_PIN_PIN(pin));
101
-    else
102
-      LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOCLR = LPC_PIN(LPC1768_PIN_PIN(pin));
103
-  }
104 108
 
105
-  uint8_t u8g_GetPinLevel(uint8_t pin) {
106
-#define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
107
-#define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
108
-    return (uint32_t)LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOPIN & LPC_PIN(LPC1768_PIN_PIN(pin)) ? 1 : 0;
109
+#ifdef __cplusplus
109 110
   }
110
-
111
-
112
-  #ifdef __cplusplus
113
-    }
114
-  #endif
115
-
116 111
 #endif
112
+
113
+#endif // TARGET_LPC1768

+ 25
- 25
Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp 查看文件

@@ -115,8 +115,8 @@ PWM_map ISR_table[NUM_PWMS] = PWM_MAP_INIT;
115 115
 #define P1_18_PWM_channel  1  // servo 3
116 116
 #define P1_20_PWM_channel  2  // servo 0
117 117
 #define P1_21_PWM_channel  3  // servo 1
118
-#define P2_4_PWM_channel   5  // D9
119
-#define P2_5_PWM_channel   6  // D10
118
+#define P2_04_PWM_channel  5  // D9
119
+#define P2_05_PWM_channel  6  // D10
120 120
 
121 121
 // used to keep track of which Match Registers have been used and if they will be used by the
122 122
 // PWM1 module to directly control the pin or will be used to generate an interrupt
@@ -138,8 +138,8 @@ void LPC1768_PWM_update_map_MR(void) {
138 138
   map_MR[1] = { 0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + P1_20_PWM_channel) ? 1 : 0), P1_20, &LPC_PWM1->MR2, 0, 0, 0 };
139 139
   map_MR[2] = { 0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + P1_21_PWM_channel) ? 1 : 0), P1_21, &LPC_PWM1->MR3, 0, 0, 0 };
140 140
   map_MR[3] = { 0, 0, P_NC, &LPC_PWM1->MR4, 0, 0, 0 };
141
-  map_MR[4] = { 0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + P2_4_PWM_channel) ? 1 : 0), P2_4, &LPC_PWM1->MR5, 0, 0, 0 };
142
-  map_MR[5] = { 0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + P2_5_PWM_channel) ? 1 : 0), P2_5, &LPC_PWM1->MR6, 0, 0, 0 };
141
+  map_MR[4] = { 0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + P2_04_PWM_channel) ? 1 : 0), P2_04, &LPC_PWM1->MR5, 0, 0, 0 };
142
+  map_MR[5] = { 0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + P2_05_PWM_channel) ? 1 : 0), P2_05, &LPC_PWM1->MR6, 0, 0, 0 };
143 143
 }
144 144
 
145 145
 /**
@@ -279,19 +279,19 @@ bool LPC1768_PWM_detach_pin(pin_t pin) {
279 279
       map_MR[P1_18_PWM_channel - 1].PINSEL_bits =  0;
280 280
       map_MR[P1_18_PWM_channel - 1].map_PWM_INT = 0;                // 0 - available for interrupts, 1 - in use by PWM
281 281
       break;
282
-    case P2_4:                        // D9 FET, PWM1 channel 5  (Pin 9  P2_4 PWM1.5)
283
-      LPC_PWM1->PCR &= ~(_BV(8 + P2_4_PWM_channel));                  // disable PWM1 module control of this pin
284
-      map_MR[P2_4_PWM_channel - 1].PCR_bit = 0;
282
+    case P2_04:                        // D9 FET, PWM1 channel 5  (Pin 9  P2_04 PWM1.5)
283
+      LPC_PWM1->PCR &= ~(_BV(8 + P2_04_PWM_channel));                  // disable PWM1 module control of this pin
284
+      map_MR[P2_04_PWM_channel - 1].PCR_bit = 0;
285 285
       LPC_PINCON->PINSEL4 &= ~(0x3 << 10);  // return pin to general purpose I/O
286
-      map_MR[P2_4_PWM_channel - 1].PINSEL_bits = 0;
287
-      map_MR[P2_4_PWM_channel - 1].map_PWM_INT = 0;                // 0 - available for interrupts, 1 - in use by PWM
286
+      map_MR[P2_04_PWM_channel - 1].PINSEL_bits = 0;
287
+      map_MR[P2_04_PWM_channel - 1].map_PWM_INT = 0;                // 0 - available for interrupts, 1 - in use by PWM
288 288
       break;
289
-    case P2_5:                        // D10 FET, PWM1 channel 6 (Pin 10  P2_5 PWM1.6)
290
-      LPC_PWM1->PCR &= ~(_BV(8 + P2_5_PWM_channel));                  // disable PWM1 module control of this pin
291
-      map_MR[P2_5_PWM_channel - 1].PCR_bit =  0;
289
+    case P2_05:                        // D10 FET, PWM1 channel 6 (Pin 10  P2_05 PWM1.6)
290
+      LPC_PWM1->PCR &= ~(_BV(8 + P2_05_PWM_channel));                  // disable PWM1 module control of this pin
291
+      map_MR[P2_05_PWM_channel - 1].PCR_bit =  0;
292 292
       LPC_PINCON->PINSEL4 &= ~(0x3 <<  4);  // return pin to general purpose I/O
293
-      map_MR[P2_5_PWM_channel - 1].PINSEL_bits =  0;
294
-      map_MR[P2_5_PWM_channel - 1].map_PWM_INT = 0;                // 0 - available for interrupts, 1 - in use by PWM
293
+      map_MR[P2_05_PWM_channel - 1].PINSEL_bits =  0;
294
+      map_MR[P2_05_PWM_channel - 1].map_PWM_INT = 0;                // 0 - available for interrupts, 1 - in use by PWM
295 295
       break;
296 296
     default:
297 297
       break;
@@ -333,17 +333,17 @@ bool LPC1768_PWM_write(pin_t pin, uint32_t value) {
333 333
     case P1_18:                        // Servo 3, PWM1 channel 1 (Pin 4  P1.18 PWM1.1)
334 334
       map_MR[P1_18_PWM_channel - 1].PCR_bit = _BV(8 + P1_18_PWM_channel);                  // enable PWM1 module control of this pin
335 335
       map_MR[P1_18_PWM_channel - 1].PINSEL_reg = &LPC_PINCON->PINSEL3;
336
-      map_MR[P1_18_PWM_channel - 1].PINSEL_bits =  0x2 <<  4;       // ISR must do this AFTER setting PCR
336
+      map_MR[P1_18_PWM_channel - 1].PINSEL_bits = 0x2 <<  4;       // ISR must do this AFTER setting PCR
337 337
       break;
338
-    case P2_4:                        // D9 FET, PWM1 channel 5 (Pin 9  P2_4 PWM1.5)
339
-      map_MR[P2_4_PWM_channel - 1].PCR_bit = _BV(8 + P2_4_PWM_channel);                  // enable PWM1 module control of this pin
340
-      map_MR[P2_4_PWM_channel - 1].PINSEL_reg = &LPC_PINCON->PINSEL4;
341
-      map_MR[P2_4_PWM_channel - 1].PINSEL_bits = 0x1 << 8;       // ISR must do this AFTER setting PCR
338
+    case P2_04:                        // D9 FET, PWM1 channel 5 (Pin 9  P2_04 PWM1.5)
339
+      map_MR[P2_04_PWM_channel - 1].PCR_bit = _BV(8 + P2_04_PWM_channel);                  // enable PWM1 module control of this pin
340
+      map_MR[P2_04_PWM_channel - 1].PINSEL_reg = &LPC_PINCON->PINSEL4;
341
+      map_MR[P2_04_PWM_channel - 1].PINSEL_bits = 0x1 <<  8;       // ISR must do this AFTER setting PCR
342 342
       break;
343
-    case P2_5:                        // D10 FET, PWM1 channel 6 (Pin 10  P2_5 PWM1.6)
344
-      map_MR[P2_5_PWM_channel - 1].PCR_bit = _BV(8 + P2_5_PWM_channel);                  // enable PWM1 module control of this pin
345
-      map_MR[P2_5_PWM_channel - 1].PINSEL_reg = &LPC_PINCON->PINSEL4;
346
-      map_MR[P2_5_PWM_channel - 1].PINSEL_bits =  0x1 <<  10;       // ISR must do this AFTER setting PCR
343
+    case P2_05:                        // D10 FET, PWM1 channel 6 (Pin 10  P2_05 PWM1.6)
344
+      map_MR[P2_05_PWM_channel - 1].PCR_bit = _BV(8 + P2_05_PWM_channel);                  // enable PWM1 module control of this pin
345
+      map_MR[P2_05_PWM_channel - 1].PINSEL_reg = &LPC_PINCON->PINSEL4;
346
+      map_MR[P2_05_PWM_channel - 1].PINSEL_bits = 0x1 << 10;       // ISR must do this AFTER setting PCR
347 347
       break;
348 348
     default:  // ISR pins
349 349
       pinMode(pin, OUTPUT);  // set pin to output
@@ -466,8 +466,8 @@ HAL_PWM_LPC1768_ISR {
466 466
       if (ISR_table[i].active_flag && !((ISR_table[i].pin == P1_20) ||
467 467
                                         (ISR_table[i].pin == P1_21) ||
468 468
                                         (ISR_table[i].pin == P1_18) ||
469
-                                        (ISR_table[i].pin == P2_4)  ||
470
-                                        (ISR_table[i].pin == P2_5))
469
+                                        (ISR_table[i].pin == P2_04) ||
470
+                                        (ISR_table[i].pin == P2_05))
471 471
       ) {
472 472
         *ISR_table[i].set_register = ISR_table[i].write_mask;       // set pins for all enabled interrupt channels active
473 473
       }

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp 查看文件

@@ -39,7 +39,7 @@
39 39
 #include "../../inc/MarlinConfig.h"
40 40
 #include <stdint.h>
41 41
 #include <stdarg.h>
42
-#include "arduino.h"
42
+#include "include/arduino.h"
43 43
 #include "pinmapping.h"
44 44
 #include "fastio.h"
45 45
 #include "SoftwareSerial.h"

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.h 查看文件

@@ -33,7 +33,7 @@
33 33
 #ifndef SOFTWARESERIAL_H
34 34
 #define SOFTWARESERIAL_H
35 35
 
36
-#include "arduino.h"
36
+#include "include/arduino.h"
37 37
 #include <stdint.h>
38 38
 //#include "serial.h"
39 39
 #include <Stream.h>

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/fastio.h 查看文件

@@ -36,7 +36,7 @@
36 36
 #define _FASTIO_LPC1768_H
37 37
 
38 38
 #include <LPC17xx.h>
39
-#include "arduino.h"
39
+#include "include/arduino.h"
40 40
 #include "pinmapping.h"
41 41
 
42 42
 bool useable_hardware_PWM(pin_t pin);

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/main.cpp 查看文件

@@ -30,7 +30,7 @@ extern "C" {
30 30
 #include "HAL_timers.h"
31 31
 #include <stdio.h>
32 32
 #include <stdarg.h>
33
-#include "arduino.h"
33
+#include "include/arduino.h"
34 34
 #include "serial.h"
35 35
 #include "LPC1768_PWM.h"
36 36
 

+ 42
- 18
Marlin/src/HAL/HAL_LPC1768/pinmapping.cpp 查看文件

@@ -22,29 +22,53 @@
22 22
 
23 23
 #ifdef TARGET_LPC1768
24 24
 
25
-#include "../../inc/MarlinConfig.h"
25
+#include "pinmapping.h"
26
+
26 27
 #include "../../gcode/parser.h"
27 28
 
28
-int16_t GET_PIN_MAP_INDEX(pin_t pin) {
29
-  const uint8_t pin_port = LPC1768_PIN_PORT(pin),
30
-                pin_pin = LPC1768_PIN_PIN(pin);
31
-  for (size_t i = 0; i < NUM_DIGITAL_PINS; ++i)
32
-    if (LPC1768_PIN_PORT(pin_map[i]) == pin_port && LPC1768_PIN_PIN(pin_map[i]) == pin_pin)
33
-      return i;
29
+// Get the digital pin for an analog index
30
+pin_t analogInputToDigitalPin(const uint8_t p) {
31
+  return (p < COUNT(adc_pin_table) ? adc_pin_table[p] : P_NC);
32
+}
33
+
34
+// Return the index of a pin number
35
+// The pin number given here is in the form ppp:nnnnn
36
+int16_t GET_PIN_MAP_INDEX(const pin_t pin) {
37
+  const uint16_t index = (LPC1768_PIN_PORT(pin) << 5) | LPC1768_PIN_PIN(pin);
38
+  return (index < NUM_DIGITAL_PINS && pin_map[index] != P_NC) ? index : -1;
39
+}
40
+
41
+// Test whether the pin is valid
42
+bool VALID_PIN(const pin_t p) {
43
+  const int16_t ind = GET_PIN_MAP_INDEX(p);
44
+  return ind >= 0 && pin_map[ind] >= 0;
45
+}
34 46
 
35
-  return -1;
47
+// Get the analog index for a digital pin
48
+int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p) {
49
+  return (VALID_PIN(p) ? LPC1768_PIN_ADC(p) : -1);
36 50
 }
37 51
 
38
-int16_t PARSED_PIN_INDEX(char code, int16_t dval) {
39
-  if (parser.seenval(code)) {
40
-    int port, pin;
41
-    if (sscanf(parser.strval(code), "%d.%d", &port, &pin) == 2)
42
-      for (size_t i = 0; i < NUM_DIGITAL_PINS; ++i)
43
-        if (LPC1768_PIN_PORT(pin_map[i]) == port && LPC1768_PIN_PIN(pin_map[i]) == pin)
44
-          return i;
45
-  }
52
+// Test whether the pin is PWM
53
+bool PWM_PIN(const pin_t p) {
54
+  return VALID_PIN(p) && LPC1768_PIN_PWM(p);
55
+}
56
+
57
+// Test whether the pin is interruptable
58
+bool INTERRUPT_PIN(const pin_t p) {
59
+  return VALID_PIN(p) && LPC1768_PIN_INTERRUPT(p);
60
+}
61
+
62
+// Get the pin number at the given index
63
+pin_t GET_PIN_MAP_PIN(const int16_t ind) {
64
+  return WITHIN(ind, 0, NUM_DIGITAL_PINS - 1) ? pin_map[ind] : P_NC;
65
+}
46 66
 
47
-  return dval;
67
+int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
68
+  const uint16_t val = (uint16_t)parser.intval(code), port = val / 100, pin = val % 100;
69
+  const  int16_t ind = (port < (NUM_DIGITAL_PINS >> 5) && (pin < 32))
70
+                      ? GET_PIN_MAP_INDEX(port << 5 | pin) : -2;
71
+  return ind > -2 ? ind : dval;
48 72
 }
49 73
 
50
-#endif // TARGET_LPC1768
74
+#endif // TARGET_LPC1768

+ 152
- 153
Marlin/src/HAL/HAL_LPC1768/pinmapping.h 查看文件

@@ -20,10 +20,10 @@
20 20
  *
21 21
  */
22 22
 
23
-#ifndef __HAL_PINMAPPING_H__
24
-#define __HAL_PINMAPPING_H__
23
+#ifndef _PINMAPPING_H_
24
+#define _PINMAPPING_H_
25 25
 
26
-#include "../../core/macros.h"
26
+#include "../../inc/MarlinConfigPre.h"
27 27
 
28 28
 #include <stdint.h>
29 29
 
@@ -94,6 +94,7 @@ typedef int16_t pin_t;
94 94
 #define INTERRUPT(b)  BOOL_(b)
95 95
 #define PWM(b)        BOOL_(b)
96 96
 
97
+// Combine elements into pin bits: 0b00AAAAWIPPPNNNNN
97 98
 #define LPC1768_PIN_(port, pin, int, pwm, adc)  0b00##adc##pwm##int##port##pin
98 99
 #define LPC1768_PIN(port, pin, int, pwm, adc)   LPC1768_PIN_(port, pin, int, pwm, adc)
99 100
 
@@ -106,178 +107,176 @@ constexpr int8_t LPC1768_PIN_ADC(const pin_t pin) { return (int8_t)((pin >> 10)
106 107
 // ******************
107 108
 // Runtime pinmapping
108 109
 // ******************
109
-#define P_NC   -1
110
+#define P_NC -1
110 111
 
111 112
 #if SERIAL_PORT != 3
112
-  #define P0_0   LPC1768_PIN(PORT(0), PIN(0), INTERRUPT(1), PWM(0), ADC_NONE)
113
-  #define P0_1   LPC1768_PIN(PORT(0), PIN(1), INTERRUPT(1), PWM(0), ADC_NONE)
113
+  #define P0_00 LPC1768_PIN(PORT(0), PIN( 0), INTERRUPT(1), PWM(0), ADC_NONE)
114
+  #define P0_01 LPC1768_PIN(PORT(0), PIN( 1), INTERRUPT(1), PWM(0), ADC_NONE)
114 115
 #endif
115 116
 #if SERIAL_PORT != 0
116
-  #define P0_2   LPC1768_PIN(PORT(0), PIN(2), INTERRUPT(1), PWM(0), ADC_CHAN(7))
117
-  #define P0_3   LPC1768_PIN(PORT(0), PIN(3), INTERRUPT(1), PWM(0), ADC_CHAN(6))
117
+  #define P0_02 LPC1768_PIN(PORT(0), PIN( 2), INTERRUPT(1), PWM(0), ADC_CHAN(7))
118
+  #define P0_03 LPC1768_PIN(PORT(0), PIN( 3), INTERRUPT(1), PWM(0), ADC_CHAN(6))
118 119
 #endif
119
-#define P0_4   LPC1768_PIN(PORT(0), PIN(4), INTERRUPT(1), PWM(0), ADC_NONE)
120
-#define P0_5   LPC1768_PIN(PORT(0), PIN(5), INTERRUPT(1), PWM(0), ADC_NONE)
121
-#define P0_6   LPC1768_PIN(PORT(0), PIN(6), INTERRUPT(1), PWM(0), ADC_NONE)
122
-#define P0_7   LPC1768_PIN(PORT(0), PIN(7), INTERRUPT(1), PWM(0), ADC_NONE)
123
-#define P0_8   LPC1768_PIN(PORT(0), PIN(8), INTERRUPT(1), PWM(0), ADC_NONE)
124
-#define P0_9   LPC1768_PIN(PORT(0), PIN(9), INTERRUPT(1), PWM(0), ADC_NONE)
120
+#define P0_04   LPC1768_PIN(PORT(0), PIN( 4), INTERRUPT(1), PWM(0), ADC_NONE)
121
+#define P0_05   LPC1768_PIN(PORT(0), PIN( 5), INTERRUPT(1), PWM(0), ADC_NONE)
122
+#define P0_06   LPC1768_PIN(PORT(0), PIN( 6), INTERRUPT(1), PWM(0), ADC_NONE)
123
+#define P0_07   LPC1768_PIN(PORT(0), PIN( 7), INTERRUPT(1), PWM(0), ADC_NONE)
124
+#define P0_08   LPC1768_PIN(PORT(0), PIN( 8), INTERRUPT(1), PWM(0), ADC_NONE)
125
+#define P0_09   LPC1768_PIN(PORT(0), PIN( 9), INTERRUPT(1), PWM(0), ADC_NONE)
125 126
 #if SERIAL_PORT != 2
126
-  #define P0_10  LPC1768_PIN(PORT(0), PIN(10), INTERRUPT(1), PWM(0), ADC_NONE)
127
-  #define P0_11  LPC1768_PIN(PORT(0), PIN(11), INTERRUPT(1), PWM(0), ADC_NONE)
127
+  #define P0_10 LPC1768_PIN(PORT(0), PIN(10), INTERRUPT(1), PWM(0), ADC_NONE)
128
+  #define P0_11 LPC1768_PIN(PORT(0), PIN(11), INTERRUPT(1), PWM(0), ADC_NONE)
128 129
 #endif
129 130
 #if SERIAL_PORT != 1
130
-  #define P0_15  LPC1768_PIN(PORT(0), PIN(15), INTERRUPT(1), PWM(0), ADC_NONE)
131
-  #define P0_16  LPC1768_PIN(PORT(0), PIN(16), INTERRUPT(1), PWM(0), ADC_NONE)
131
+  #define P0_15 LPC1768_PIN(PORT(0), PIN(15), INTERRUPT(1), PWM(0), ADC_NONE)
132
+  #define P0_16 LPC1768_PIN(PORT(0), PIN(16), INTERRUPT(1), PWM(0), ADC_NONE)
132 133
 #endif
133
-#define P0_17  LPC1768_PIN(PORT(0), PIN(17), INTERRUPT(1), PWM(0), ADC_NONE)
134
-#define P0_18  LPC1768_PIN(PORT(0), PIN(18), INTERRUPT(1), PWM(0), ADC_NONE)
135
-#define P0_19  LPC1768_PIN(PORT(0), PIN(19), INTERRUPT(1), PWM(0), ADC_NONE)
136
-#define P0_20  LPC1768_PIN(PORT(0), PIN(20), INTERRUPT(1), PWM(0), ADC_NONE)
137
-#define P0_21  LPC1768_PIN(PORT(0), PIN(21), INTERRUPT(1), PWM(0), ADC_NONE)
138
-#define P0_22  LPC1768_PIN(PORT(0), PIN(22), INTERRUPT(1), PWM(0), ADC_NONE)
139
-#define P0_23  LPC1768_PIN(PORT(0), PIN(23), INTERRUPT(1), PWM(0), ADC_CHAN(0))
140
-#define P0_24  LPC1768_PIN(PORT(0), PIN(24), INTERRUPT(1), PWM(0), ADC_CHAN(1))
141
-#define P0_25  LPC1768_PIN(PORT(0), PIN(25), INTERRUPT(1), PWM(0), ADC_CHAN(2))
142
-#define P0_26  LPC1768_PIN(PORT(0), PIN(26), INTERRUPT(1), PWM(0), ADC_CHAN(3))
143
-#define P0_27  LPC1768_PIN(PORT(0), PIN(27), INTERRUPT(1), PWM(0), ADC_NONE)
144
-#define P0_28  LPC1768_PIN(PORT(0), PIN(28), INTERRUPT(1), PWM(0), ADC_NONE)
145
-#define P0_29  LPC1768_PIN(PORT(0), PIN(29), INTERRUPT(1), PWM(0), ADC_NONE)
146
-#define P0_30  LPC1768_PIN(PORT(0), PIN(30), INTERRUPT(1), PWM(0), ADC_NONE)
147
-#define P1_0   LPC1768_PIN(PORT(1), PIN(0), INTERRUPT(0), PWM(0), ADC_NONE)
148
-#define P1_1   LPC1768_PIN(PORT(1), PIN(1), INTERRUPT(0), PWM(0), ADC_NONE)
149
-#define P1_4   LPC1768_PIN(PORT(1), PIN(4), INTERRUPT(0), PWM(0), ADC_NONE)
150
-#define P1_8   LPC1768_PIN(PORT(1), PIN(8), INTERRUPT(0), PWM(0), ADC_NONE)
151
-#define P1_9   LPC1768_PIN(PORT(1), PIN(9), INTERRUPT(0), PWM(0), ADC_NONE)
152
-#define P1_10  LPC1768_PIN(PORT(1), PIN(10), INTERRUPT(0), PWM(0), ADC_NONE)
153
-#define P1_14  LPC1768_PIN(PORT(1), PIN(14), INTERRUPT(0), PWM(0), ADC_NONE)
154
-#define P1_15  LPC1768_PIN(PORT(1), PIN(15), INTERRUPT(0), PWM(0), ADC_NONE)
155
-#define P1_16  LPC1768_PIN(PORT(1), PIN(16), INTERRUPT(0), PWM(0), ADC_NONE)
156
-#define P1_17  LPC1768_PIN(PORT(1), PIN(17), INTERRUPT(0), PWM(0), ADC_NONE)
157
-#define P1_18  LPC1768_PIN(PORT(1), PIN(18), INTERRUPT(0), PWM(1), ADC_NONE)
158
-#define P1_19  LPC1768_PIN(PORT(1), PIN(19), INTERRUPT(0), PWM(0), ADC_NONE)
159
-#define P1_20  LPC1768_PIN(PORT(1), PIN(20), INTERRUPT(0), PWM(1), ADC_NONE)
160
-#define P1_21  LPC1768_PIN(PORT(1), PIN(21), INTERRUPT(0), PWM(1), ADC_NONE)
161
-#define P1_22  LPC1768_PIN(PORT(1), PIN(22), INTERRUPT(0), PWM(0), ADC_NONE)
162
-#define P1_23  LPC1768_PIN(PORT(1), PIN(23), INTERRUPT(0), PWM(1), ADC_NONE)
163
-#define P1_24  LPC1768_PIN(PORT(1), PIN(24), INTERRUPT(0), PWM(1), ADC_NONE)
164
-#define P1_25  LPC1768_PIN(PORT(1), PIN(25), INTERRUPT(0), PWM(0), ADC_NONE)
165
-#define P1_26  LPC1768_PIN(PORT(1), PIN(26), INTERRUPT(0), PWM(1), ADC_NONE)
166
-#define P1_27  LPC1768_PIN(PORT(1), PIN(27), INTERRUPT(0), PWM(0), ADC_NONE)
167
-#define P1_28  LPC1768_PIN(PORT(1), PIN(28), INTERRUPT(0), PWM(0), ADC_NONE)
168
-#define P1_29  LPC1768_PIN(PORT(1), PIN(29), INTERRUPT(0), PWM(0), ADC_NONE)
169
-#define P1_30  LPC1768_PIN(PORT(1), PIN(30), INTERRUPT(0), PWM(0), ADC_CHAN(4))
170
-#define P1_31  LPC1768_PIN(PORT(1), PIN(31), INTERRUPT(0), PWM(0), ADC_CHAN(5))
171
-#define P2_0   LPC1768_PIN(PORT(2), PIN(0), INTERRUPT(1), PWM(1), ADC_NONE)
172
-#define P2_1   LPC1768_PIN(PORT(2), PIN(1), INTERRUPT(1), PWM(1), ADC_NONE)
173
-#define P2_2   LPC1768_PIN(PORT(2), PIN(2), INTERRUPT(1), PWM(1), ADC_NONE)
174
-#define P2_3   LPC1768_PIN(PORT(2), PIN(3), INTERRUPT(1), PWM(1), ADC_NONE)
175
-#define P2_4   LPC1768_PIN(PORT(2), PIN(4), INTERRUPT(1), PWM(1), ADC_NONE)
176
-#define P2_5   LPC1768_PIN(PORT(2), PIN(5), INTERRUPT(1), PWM(1), ADC_NONE)
177
-#define P2_6   LPC1768_PIN(PORT(2), PIN(6), INTERRUPT(1), PWM(0), ADC_NONE)
178
-#define P2_7   LPC1768_PIN(PORT(2), PIN(7), INTERRUPT(1), PWM(0), ADC_NONE)
179
-#define P2_8   LPC1768_PIN(PORT(2), PIN(8), INTERRUPT(1), PWM(0), ADC_NONE)
180
-#define P2_9   LPC1768_PIN(PORT(2), PIN(9), INTERRUPT(1), PWM(0), ADC_NONE)
181
-#define P2_10  LPC1768_PIN(PORT(2), PIN(10), INTERRUPT(1), PWM(0), ADC_NONE)
182
-#define P2_11  LPC1768_PIN(PORT(2), PIN(11), INTERRUPT(1), PWM(0), ADC_NONE)
183
-#define P2_12  LPC1768_PIN(PORT(2), PIN(12), INTERRUPT(1), PWM(0), ADC_NONE)
184
-#define P2_13  LPC1768_PIN(PORT(2), PIN(13), INTERRUPT(1), PWM(0), ADC_NONE)
185
-#define P3_25  LPC1768_PIN(PORT(3), PIN(25), INTERRUPT(0), PWM(1), ADC_NONE)
186
-#define P3_26  LPC1768_PIN(PORT(3), PIN(26), INTERRUPT(0), PWM(1), ADC_NONE)
187
-#define P4_28  LPC1768_PIN(PORT(4), PIN(28), INTERRUPT(0), PWM(0), ADC_NONE)
188
-#define P4_29  LPC1768_PIN(PORT(4), PIN(29), INTERRUPT(0), PWM(0), ADC_NONE)
189
-
190
-constexpr bool VALID_PIN(const pin_t p) {
191
-  return (
192
-    #if SERIAL_PORT == 0
193
-      (LPC1768_PIN_PORT(p) == 0 && LPC1768_PIN_PIN(p) <= 1)             ||
194
-      (LPC1768_PIN_PORT(p) == 0 && WITHIN(LPC1768_PIN_PIN(p), 4, 11))   ||
195
-    #elif SERIAL_PORT == 2
196
-      (LPC1768_PIN_PORT(p) == 0 && LPC1768_PIN_PIN(p) <= 9)             ||
197
-    #elif SERIAL_PORT == 3
198
-      (LPC1768_PIN_PORT(p) == 0 && WITHIN(LPC1768_PIN_PIN(p), 2, 11))   ||
199
-    #else
200
-      (LPC1768_PIN_PORT(p) == 0 && LPC1768_PIN_PIN(p) <= 11)            ||
201
-    #endif
202
-    #if SERIAL_PORT == 1
203
-      (LPC1768_PIN_PORT(p) == 0 && WITHIN(LPC1768_PIN_PIN(p), 17, 30))  ||
204
-    #else
205
-      (LPC1768_PIN_PORT(p) == 0 && WITHIN(LPC1768_PIN_PIN(p), 15, 30))  ||
206
-    #endif
207
-    (LPC1768_PIN_PORT(p) == 1 && LPC1768_PIN_PIN(p) == 1)             ||
208
-    (LPC1768_PIN_PORT(p) == 1 && LPC1768_PIN_PIN(p) == 4)             ||
209
-    (LPC1768_PIN_PORT(p) == 1 && WITHIN(LPC1768_PIN_PIN(p), 8, 10))   ||
210
-    (LPC1768_PIN_PORT(p) == 1 && WITHIN(LPC1768_PIN_PIN(p), 14, 31))  ||
211
-    (LPC1768_PIN_PORT(p) == 2 && LPC1768_PIN_PIN(p) <= 13)            ||
212
-    (LPC1768_PIN_PORT(p) == 3 && WITHIN(LPC1768_PIN_PIN(p), 25, 26))  ||
213
-    (LPC1768_PIN_PORT(p) == 4 && WITHIN(LPC1768_PIN_PIN(p), 28, 29))
214
-  );
215
-}
216
-
217
-constexpr bool PWM_PIN(const pin_t p) {
218
-  return (VALID_PIN(p) && LPC1768_PIN_PWM(p));
219
-}
220
-
221
-constexpr bool INTERRUPT_PIN(const pin_t p) {
222
-  return (VALID_PIN(p) && LPC1768_PIN_INTERRUPT(p));
223
-}
224
-
225
-#if SERIAL_PORT == 0
226
-  #define NUM_ANALOG_INPUTS 6
227
-#else
228
-  #define NUM_ANALOG_INPUTS 8
229
-#endif
230
-
231
-constexpr pin_t adc_pin_table[] = {
232
-  P0_23, P0_24, P0_25, P0_26, P1_30, P1_31,
233
-  #if SERIAL_PORT != 0
234
-    P0_3, P0_2
235
-  #endif
236
-};
237
-
238
-constexpr pin_t analogInputToDigitalPin(const uint8_t p) {
239
-  return (p < COUNT(adc_pin_table) ? adc_pin_table[p] : P_NC);
240
-}
134
+#define P0_17   LPC1768_PIN(PORT(0), PIN(17), INTERRUPT(1), PWM(0), ADC_NONE)
135
+#define P0_18   LPC1768_PIN(PORT(0), PIN(18), INTERRUPT(1), PWM(0), ADC_NONE)
136
+#define P0_19   LPC1768_PIN(PORT(0), PIN(19), INTERRUPT(1), PWM(0), ADC_NONE)
137
+#define P0_20   LPC1768_PIN(PORT(0), PIN(20), INTERRUPT(1), PWM(0), ADC_NONE)
138
+#define P0_21   LPC1768_PIN(PORT(0), PIN(21), INTERRUPT(1), PWM(0), ADC_NONE)
139
+#define P0_22   LPC1768_PIN(PORT(0), PIN(22), INTERRUPT(1), PWM(0), ADC_NONE)
140
+#define P0_23   LPC1768_PIN(PORT(0), PIN(23), INTERRUPT(1), PWM(0), ADC_CHAN(0))
141
+#define P0_24   LPC1768_PIN(PORT(0), PIN(24), INTERRUPT(1), PWM(0), ADC_CHAN(1))
142
+#define P0_25   LPC1768_PIN(PORT(0), PIN(25), INTERRUPT(1), PWM(0), ADC_CHAN(2))
143
+#define P0_26   LPC1768_PIN(PORT(0), PIN(26), INTERRUPT(1), PWM(0), ADC_CHAN(3))
144
+#define P0_27   LPC1768_PIN(PORT(0), PIN(27), INTERRUPT(1), PWM(0), ADC_NONE)
145
+#define P0_28   LPC1768_PIN(PORT(0), PIN(28), INTERRUPT(1), PWM(0), ADC_NONE)
146
+#define P0_29   LPC1768_PIN(PORT(0), PIN(29), INTERRUPT(1), PWM(0), ADC_NONE)
147
+#define P0_30   LPC1768_PIN(PORT(0), PIN(30), INTERRUPT(1), PWM(0), ADC_NONE)
148
+#define P1_00   LPC1768_PIN(PORT(1), PIN( 0), INTERRUPT(0), PWM(0), ADC_NONE)
149
+#define P1_01   LPC1768_PIN(PORT(1), PIN( 1), INTERRUPT(0), PWM(0), ADC_NONE)
150
+#define P1_04   LPC1768_PIN(PORT(1), PIN( 4), INTERRUPT(0), PWM(0), ADC_NONE)
151
+#define P1_08   LPC1768_PIN(PORT(1), PIN( 8), INTERRUPT(0), PWM(0), ADC_NONE)
152
+#define P1_09   LPC1768_PIN(PORT(1), PIN( 9), INTERRUPT(0), PWM(0), ADC_NONE)
153
+#define P1_10   LPC1768_PIN(PORT(1), PIN(10), INTERRUPT(0), PWM(0), ADC_NONE)
154
+#define P1_14   LPC1768_PIN(PORT(1), PIN(14), INTERRUPT(0), PWM(0), ADC_NONE)
155
+#define P1_15   LPC1768_PIN(PORT(1), PIN(15), INTERRUPT(0), PWM(0), ADC_NONE)
156
+#define P1_16   LPC1768_PIN(PORT(1), PIN(16), INTERRUPT(0), PWM(0), ADC_NONE)
157
+#define P1_17   LPC1768_PIN(PORT(1), PIN(17), INTERRUPT(0), PWM(0), ADC_NONE)
158
+#define P1_18   LPC1768_PIN(PORT(1), PIN(18), INTERRUPT(0), PWM(1), ADC_NONE)
159
+#define P1_19   LPC1768_PIN(PORT(1), PIN(19), INTERRUPT(0), PWM(0), ADC_NONE)
160
+#define P1_20   LPC1768_PIN(PORT(1), PIN(20), INTERRUPT(0), PWM(1), ADC_NONE)
161
+#define P1_21   LPC1768_PIN(PORT(1), PIN(21), INTERRUPT(0), PWM(1), ADC_NONE)
162
+#define P1_22   LPC1768_PIN(PORT(1), PIN(22), INTERRUPT(0), PWM(0), ADC_NONE)
163
+#define P1_23   LPC1768_PIN(PORT(1), PIN(23), INTERRUPT(0), PWM(1), ADC_NONE)
164
+#define P1_24   LPC1768_PIN(PORT(1), PIN(24), INTERRUPT(0), PWM(1), ADC_NONE)
165
+#define P1_25   LPC1768_PIN(PORT(1), PIN(25), INTERRUPT(0), PWM(0), ADC_NONE)
166
+#define P1_26   LPC1768_PIN(PORT(1), PIN(26), INTERRUPT(0), PWM(1), ADC_NONE)
167
+#define P1_27   LPC1768_PIN(PORT(1), PIN(27), INTERRUPT(0), PWM(0), ADC_NONE)
168
+#define P1_28   LPC1768_PIN(PORT(1), PIN(28), INTERRUPT(0), PWM(0), ADC_NONE)
169
+#define P1_29   LPC1768_PIN(PORT(1), PIN(29), INTERRUPT(0), PWM(0), ADC_NONE)
170
+#define P1_30   LPC1768_PIN(PORT(1), PIN(30), INTERRUPT(0), PWM(0), ADC_CHAN(4))
171
+#define P1_31   LPC1768_PIN(PORT(1), PIN(31), INTERRUPT(0), PWM(0), ADC_CHAN(5))
172
+#define P2_00   LPC1768_PIN(PORT(2), PIN( 0), INTERRUPT(1), PWM(1), ADC_NONE)
173
+#define P2_01   LPC1768_PIN(PORT(2), PIN( 1), INTERRUPT(1), PWM(1), ADC_NONE)
174
+#define P2_02   LPC1768_PIN(PORT(2), PIN( 2), INTERRUPT(1), PWM(1), ADC_NONE)
175
+#define P2_03   LPC1768_PIN(PORT(2), PIN( 3), INTERRUPT(1), PWM(1), ADC_NONE)
176
+#define P2_04   LPC1768_PIN(PORT(2), PIN( 4), INTERRUPT(1), PWM(1), ADC_NONE)
177
+#define P2_05   LPC1768_PIN(PORT(2), PIN( 5), INTERRUPT(1), PWM(1), ADC_NONE)
178
+#define P2_06   LPC1768_PIN(PORT(2), PIN( 6), INTERRUPT(1), PWM(0), ADC_NONE)
179
+#define P2_07   LPC1768_PIN(PORT(2), PIN( 7), INTERRUPT(1), PWM(0), ADC_NONE)
180
+#define P2_08   LPC1768_PIN(PORT(2), PIN( 8), INTERRUPT(1), PWM(0), ADC_NONE)
181
+#define P2_09   LPC1768_PIN(PORT(2), PIN( 9), INTERRUPT(1), PWM(0), ADC_NONE)
182
+#define P2_10   LPC1768_PIN(PORT(2), PIN(10), INTERRUPT(1), PWM(0), ADC_NONE)
183
+#define P2_11   LPC1768_PIN(PORT(2), PIN(11), INTERRUPT(1), PWM(0), ADC_NONE)
184
+#define P2_12   LPC1768_PIN(PORT(2), PIN(12), INTERRUPT(1), PWM(0), ADC_NONE)
185
+#define P2_13   LPC1768_PIN(PORT(2), PIN(13), INTERRUPT(1), PWM(0), ADC_NONE)
186
+#define P3_25   LPC1768_PIN(PORT(3), PIN(25), INTERRUPT(0), PWM(1), ADC_NONE)
187
+#define P3_26   LPC1768_PIN(PORT(3), PIN(26), INTERRUPT(0), PWM(1), ADC_NONE)
188
+#define P4_28   LPC1768_PIN(PORT(4), PIN(28), INTERRUPT(0), PWM(0), ADC_NONE)
189
+#define P4_29   LPC1768_PIN(PORT(4), PIN(29), INTERRUPT(0), PWM(0), ADC_NONE)
241 190
 
242
-constexpr int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p) {
243
-  return (VALID_PIN(p) ? LPC1768_PIN_ADC(p) : -1);
244
-}
245
-
246
-// P0.6 thru P0.9 are for the onboard SD card
247
-// P0.29 and P0.30 are for the USB port
248
-#define HAL_SENSITIVE_PINS P0_6, P0_7, P0_8, P0_9, P0_29, P0_30
249
-
250
-// Pin map for M43 and M226
251
-const pin_t pin_map[] = {
191
+// Pin index for M43 and M226
192
+constexpr pin_t pin_map[] = {
252 193
   #if SERIAL_PORT != 3
253
-    P0_0,  P0_1,
194
+    P0_00, P0_01,
195
+  #else
196
+    P_NC,  P_NC,
254 197
   #endif
255 198
   #if SERIAL_PORT != 0
256
-    P0_2,  P0_3,
199
+                  P0_02, P0_03,
200
+  #else
201
+                  P_NC,  P_NC,
257 202
   #endif
258
-  P0_4,  P0_5,  P0_6,  P0_7,  P0_8,  P0_9,
203
+                                P0_04, P0_05, P0_06, P0_07,
204
+    P0_08, P0_09,
259 205
   #if SERIAL_PORT != 2
260
-    P0_10, P0_11,
206
+                  P0_10, P0_11,
207
+  #else
208
+                  P_NC,  P_NC,
261 209
   #endif
210
+                                P_NC,  P_NC,  P_NC,
262 211
   #if SERIAL_PORT != 1
263
-    P0_15, P0_16,
212
+                                                     P0_15,
213
+    P0_16,
214
+  #else
215
+                                                     P_NC,
216
+    P_NC,
264 217
   #endif
265
-  P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23, P0_24,
266
-  P0_25, P0_26, P0_27, P0_28, P0_29, P0_30,
267
-  P1_0,  P1_1,  P1_4,  P1_8,  P1_9,  P1_10, P1_14, P1_15,
218
+           P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23,
219
+    P0_24, P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, P_NC,
220
+
221
+  P1_00, P1_01, P_NC,  P_NC,  P1_04, P_NC,  P_NC,  P_NC,
222
+  P1_08, P1_09, P1_10, P_NC,  P_NC,  P_NC,  P1_14, P1_15,
268 223
   P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23,
269 224
   P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31,
270
-  P2_0,  P2_1,  P2_2,  P2_3,  P2_4,  P2_5,  P2_6,  P2_7,
271
-  P2_8,  P2_9,  P2_10, P2_11, P2_12, P2_13,
272
-  P3_25, P3_26,
273
-  P4_28, P4_29
225
+
226
+  P2_00, P2_01, P2_02, P2_03, P2_04, P2_05, P2_06, P2_07,
227
+  P2_08, P2_09, P2_10, P2_11, P2_12, P2_13, P_NC,  P_NC,
228
+  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,
229
+  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,
230
+
231
+  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,
232
+  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,
233
+  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,
234
+  P_NC,  P3_25, P3_26, P_NC,  P_NC,  P_NC,  P_NC,  P_NC,
235
+
236
+  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,
237
+  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,
238
+  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,  P_NC,
239
+  P_NC,  P_NC,  P_NC,  P_NC,  P4_28, P4_29, P_NC,  P_NC
274 240
 };
275 241
 
276
-#define NUM_DIGITAL_PINS COUNT(pin_map)
242
+constexpr int16_t NUM_DIGITAL_PINS = COUNT(pin_map);
243
+
244
+constexpr pin_t adc_pin_table[] = {
245
+  P0_23, P0_24, P0_25, P0_26, P1_30, P1_31,
246
+  #if SERIAL_PORT != 0
247
+    P0_03, P0_02
248
+  #endif
249
+};
250
+
251
+constexpr int16_t NUM_ANALOG_INPUTS = COUNT(adc_pin_table);
252
+
253
+// P0.6 thru P0.9 are for the onboard SD card
254
+// P0.29 and P0.30 are for the USB port
255
+#define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09, P0_29, P0_30
256
+
257
+// Get the digital pin for an analog index
258
+pin_t analogInputToDigitalPin(const uint8_t p);
259
+
260
+// Return the index of a pin number
261
+// The pin number given here is in the form ppp:nnnnn
262
+int16_t GET_PIN_MAP_INDEX(const pin_t pin);
263
+
264
+// Test whether the pin is valid
265
+bool VALID_PIN(const pin_t p);
266
+
267
+// Get the analog index for a digital pin
268
+int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p);
269
+
270
+// Test whether the pin is PWM
271
+bool PWM_PIN(const pin_t p);
272
+
273
+// Test whether the pin is interruptable
274
+bool INTERRUPT_PIN(const pin_t p);
277 275
 
278
-#define GET_PIN_MAP_PIN(i) (WITHIN(i, 0, (int)NUM_DIGITAL_PINS - 1) ? pin_map[i] : -1)
276
+// Get the pin number at the given index
277
+pin_t GET_PIN_MAP_PIN(const int16_t ind);
279 278
 
280
-int16_t GET_PIN_MAP_INDEX(pin_t pin);
281
-int16_t PARSED_PIN_INDEX(char code, int16_t dval = 0);
279
+// Parse a G-code word into a pin index
280
+int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
282 281
 
283
-#endif // __HAL_PINMAPPING_H__
282
+#endif // _PINMAPPING_H_

+ 4
- 4
Marlin/src/HAL/HAL_LPC1768/spi_pins.h 查看文件

@@ -26,10 +26,10 @@
26 26
 #define LPC_SOFTWARE_SPI
27 27
 
28 28
 /** onboard SD card */
29
-//#define SCK_PIN           P0_7
30
-//#define MISO_PIN          P0_8
31
-//#define MOSI_PIN          P0_9
32
-//#define SS_PIN            P0_6
29
+//#define SCK_PIN           P0_07
30
+//#define MISO_PIN          P0_08
31
+//#define MOSI_PIN          P0_09
32
+//#define SS_PIN            P0_06
33 33
 /** external */
34 34
 #define SCK_PIN           P0_15
35 35
 #define MISO_PIN          P0_17

+ 3
- 5
Marlin/src/gcode/control/M42.cpp 查看文件

@@ -28,11 +28,9 @@
28 28
  * M42: Change pin status via GCode
29 29
  *
30 30
  *  P<pin>  Pin number (LED if omitted)
31
- *            For LPC1768 use M42 P1.20 S255 if wanting to set P1_20 to logic 1
32
- *              NOTE - Repetier Host truncates trailing zeros on a decimal when
33
- *                     sending commands so typing M42 P1.20 S255 results in 
34
- *                     M42 P1.2 S255 being sent.  Pronterface doesn't have this issue.
35
- *                     
31
+ *          For LPC1768 specify pin P1_02 as M42 P102,
32
+ *                                  P1_20 as M42 P120, etc.
33
+ *
36 34
  *  S<byte> Pin status from 0 - 255
37 35
  */
38 36
 void GcodeSuite::M42() {

+ 2
- 7
Marlin/src/inc/MarlinConfig.h 查看文件

@@ -23,13 +23,8 @@
23 23
 #ifndef MARLIN_CONFIG_H
24 24
 #define MARLIN_CONFIG_H
25 25
 
26
-#include "../core/boards.h"
27
-#include "../core/macros.h"
28
-#include "Version.h"
29
-#include "../../Configuration.h"
30
-#include "Conditionals_LCD.h"
31
-#include "../../Configuration_adv.h"
32
-#include "Conditionals_adv.h"
26
+#include "MarlinConfigPre.h"
27
+
33 28
 #include "../HAL/HAL.h"
34 29
 #include "../pins/pins.h"
35 30
 #if defined(__AVR__) && !defined(USBCON)

+ 34
- 0
Marlin/src/inc/MarlinConfigPre.h 查看文件

@@ -0,0 +1,34 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#ifndef MARLIN_CONFIGPRE_H
24
+#define MARLIN_CONFIGPRE_H
25
+
26
+#include "../core/boards.h"
27
+#include "../core/macros.h"
28
+#include "Version.h"
29
+#include "../../Configuration.h"
30
+#include "Conditionals_LCD.h"
31
+#include "../../Configuration_adv.h"
32
+#include "Conditionals_adv.h"
33
+
34
+#endif // MARLIN_CONFIGPRE_H

+ 4
- 4
Marlin/src/inc/Version.h 查看文件

@@ -23,12 +23,12 @@
23 23
 #ifndef _VERSION_H_
24 24
 #define _VERSION_H_
25 25
 
26
-#include "MarlinConfig.h"
26
+#include "../core/macros.h" // for ENABLED
27 27
 
28 28
 /**
29
- * This file is the standard Marlin version identifier file, all fields can be
30
- * overriden by the ones defined in _Version.h by using the Configuration.h
31
- * directive USE_AUTOMATIC_VERSIONING.
29
+ * This file is the standard Marlin version identifier file.
30
+ * Use -DUSE_AUTOMATIC_VERSIONING=1 and a custom _Version.h
31
+ * to override these values.
32 32
  */
33 33
 
34 34
 #if ENABLED(USE_AUTOMATIC_VERSIONING)

+ 1
- 1
Marlin/src/pins/pins.h 查看文件

@@ -721,7 +721,7 @@
721 721
 #endif
722 722
 
723 723
 #ifndef HAL_SENSITIVE_PINS
724
-#define HAL_SENSITIVE_PINS
724
+  #define HAL_SENSITIVE_PINS
725 725
 #endif
726 726
 
727 727
 #define SENSITIVE_PINS { \

+ 2
- 2
Marlin/src/pins/pinsDebug.h 查看文件

@@ -43,7 +43,7 @@
43 43
 #define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
44 44
 
45 45
 #include "pinsDebug_list.h"
46
-#line 49
46
+#line 47
47 47
 
48 48
 // manually add pins that have names that are macros which don't play well with these macros
49 49
 #if SERIAL_PORT == 0 && (AVR_ATmega2560_FAMILY || AVR_ATmega1284_FAMILY)
@@ -95,7 +95,7 @@ const PinInfo pin_array[] PROGMEM = {
95 95
   #endif
96 96
 
97 97
   #include "pinsDebug_list.h"
98
-  #line 101
98
+  #line 99
99 99
 
100 100
 };
101 101
 

+ 16
- 16
Marlin/src/pins/pins_AZSMZ_MINI.h 查看文件

@@ -48,23 +48,23 @@
48 48
 //
49 49
 // Steppers
50 50
 //
51
-#define X_STEP_PIN         P2_0
52
-#define X_DIR_PIN          P0_5
53
-#define X_ENABLE_PIN       P0_4
51
+#define X_STEP_PIN         P2_00
52
+#define X_DIR_PIN          P0_05
53
+#define X_ENABLE_PIN       P0_04
54 54
 
55
-#define Y_STEP_PIN         P2_1
55
+#define Y_STEP_PIN         P2_01
56 56
 #define Y_DIR_PIN          P0_11
57 57
 #define Y_ENABLE_PIN       P0_10
58 58
 
59
-#define Z_STEP_PIN         P2_2
59
+#define Z_STEP_PIN         P2_02
60 60
 #define Z_DIR_PIN          P0_20
61 61
 #define Z_ENABLE_PIN       P0_19
62 62
 
63
-#define E0_STEP_PIN        P2_3
63
+#define E0_STEP_PIN        P2_03
64 64
 #define E0_DIR_PIN         P0_22
65 65
 #define E0_ENABLE_PIN      P0_21
66 66
 
67
-#define E1_STEP_PIN        P2_8
67
+#define E1_STEP_PIN        P2_08
68 68
 #define E1_DIR_PIN         P2_13
69 69
 #define E1_ENABLE_PIN      P4_29
70 70
 
@@ -80,14 +80,14 @@
80 80
 // Heaters / Fans
81 81
 //
82 82
 // EFB
83
-#define HEATER_0_PIN       P2_4
84
-#define HEATER_BED_PIN     P2_5
85
-#define FAN_PIN            P2_7
83
+#define HEATER_0_PIN       P2_04
84
+#define HEATER_BED_PIN     P2_05
85
+#define FAN_PIN            P2_07
86 86
 #define FAN1_PIN           P0_26
87 87
 
88 88
 #if ENABLED(AZSMZ_12864)
89 89
   #define BEEPER_PIN       P1_30
90
-  #define DOGLCD_A0        P2_6
90
+  #define DOGLCD_A0        P2_06
91 91
   #define DOGLCD_CS        P1_22
92 92
   #define BTN_EN1          P4_28
93 93
   #define BTN_EN2          P1_27
@@ -104,11 +104,11 @@
104 104
 #define ENET_RXD1          P1_10
105 105
 #define ENET_MOC           P1_16
106 106
 #define REF_CLK            P1_15
107
-#define ENET_RXD0          P1_9
108
-#define ENET_CRS           P1_8
109
-#define ENET_TX_EN         P1_4
110
-#define ENET_TXD0          P1_0
111
-#define ENET_TXD1          P1_1
107
+#define ENET_RXD0          P1_09
108
+#define ENET_CRS           P1_08
109
+#define ENET_TX_EN         P1_04
110
+#define ENET_TXD0          P1_00
111
+#define ENET_TXD1          P1_01
112 112
 
113 113
 /**
114 114
  *  PWMs

+ 11
- 11
Marlin/src/pins/pins_AZTEEG_X5_GT.h 查看文件

@@ -49,23 +49,23 @@
49 49
 //
50 50
 // Steppers
51 51
 //
52
-#define X_STEP_PIN         P2_1
52
+#define X_STEP_PIN         P2_01
53 53
 #define X_DIR_PIN          P0_11
54 54
 #define X_ENABLE_PIN       P0_10
55 55
 
56
-#define Y_STEP_PIN         P2_2
56
+#define Y_STEP_PIN         P2_02
57 57
 #define Y_DIR_PIN          P0_20
58 58
 #define Y_ENABLE_PIN       P0_19
59 59
 
60
-#define Z_STEP_PIN         P2_3
60
+#define Z_STEP_PIN         P2_03
61 61
 #define Z_DIR_PIN          P0_22
62 62
 #define Z_ENABLE_PIN       P0_21
63 63
 
64
-#define E0_STEP_PIN        P2_0
65
-#define E0_DIR_PIN         P0_5
66
-#define E0_ENABLE_PIN      P0_4
64
+#define E0_STEP_PIN        P2_00
65
+#define E0_DIR_PIN         P0_05
66
+#define E0_ENABLE_PIN      P0_04
67 67
 
68
-#define E1_STEP_PIN        P2_8
68
+#define E1_STEP_PIN        P2_08
69 69
 #define E1_DIR_PIN         P2_13
70 70
 #define E1_ENABLE_PIN      P4_29
71 71
 
@@ -82,9 +82,9 @@
82 82
 // Heaters / Fans
83 83
 //
84 84
 
85
-#define HEATER_BED_PIN     P2_7
86
-#define HEATER_0_PIN       P2_4
87
-#define HEATER_1_PIN       P2_5
85
+#define HEATER_BED_PIN     P2_07
86
+#define HEATER_0_PIN       P2_04
87
+#define HEATER_1_PIN       P2_05
88 88
 #define FAN_PIN            P0_26
89 89
 #define FAN1_PIN           P1_22
90 90
 
@@ -94,7 +94,7 @@
94 94
 
95 95
 #if ENABLED(VIKI2) || ENABLED(miniVIKI)
96 96
     #define BEEPER_PIN        P1_30
97
-    #define DOGLCD_A0         P2_6
97
+    #define DOGLCD_A0         P2_06
98 98
     #define DOGLCD_CS         P0_16
99 99
 
100 100
     #define BTN_EN1           P3_25

+ 22
- 22
Marlin/src/pins/pins_MKS_SBASE.h 查看文件

@@ -53,23 +53,23 @@
53 53
 //
54 54
 // Steppers
55 55
 //
56
-#define X_STEP_PIN         P2_0
57
-#define X_DIR_PIN          P0_5
58
-#define X_ENABLE_PIN       P0_4
56
+#define X_STEP_PIN         P2_00
57
+#define X_DIR_PIN          P0_05
58
+#define X_ENABLE_PIN       P0_04
59 59
 
60
-#define Y_STEP_PIN         P2_1
60
+#define Y_STEP_PIN         P2_01
61 61
 #define Y_DIR_PIN          P0_11
62 62
 #define Y_ENABLE_PIN       P0_10
63 63
 
64
-#define Z_STEP_PIN         P2_2
64
+#define Z_STEP_PIN         P2_02
65 65
 #define Z_DIR_PIN          P0_20
66 66
 #define Z_ENABLE_PIN       P0_19
67 67
 
68
-#define E0_STEP_PIN        P2_3
68
+#define E0_STEP_PIN        P2_03
69 69
 #define E0_DIR_PIN         P0_22
70 70
 #define E0_ENABLE_PIN      P0_21
71 71
 
72
-#define E1_STEP_PIN        P2_8
72
+#define E1_STEP_PIN        P2_08
73 73
 #define E1_DIR_PIN         P2_13
74 74
 #define E1_ENABLE_PIN      P4_29
75 75
 
@@ -88,10 +88,10 @@
88 88
 // Heaters / Fans
89 89
 //
90 90
 
91
-#define HEATER_BED_PIN     P2_5
92
-#define HEATER_0_PIN       P2_7
93
-#define HEATER_1_PIN       P2_6
94
-#define FAN_PIN            P2_4
91
+#define HEATER_BED_PIN     P2_05
92
+#define HEATER_0_PIN       P2_07
93
+#define HEATER_1_PIN       P2_06
94
+#define FAN_PIN            P2_04
95 95
 
96 96
 
97 97
 #define PS_ON_PIN          P0_25
@@ -166,11 +166,11 @@
166 166
 #endif
167 167
 #define ENET_MOC           P1_16  // J12-3
168 168
 #define REF_CLK            P1_15  // J12-5
169
-#define ENET_RXD0          P1_9   // J12-7
170
-#define ENET_CRS           P1_8   // J12-9
171
-#define ENET_TX_EN         P1_4   // J12-10
172
-#define ENET_TXD0          P1_0   // J12-11
173
-#define ENET_TXD1          P1_1   // J12-12
169
+#define ENET_RXD0          P1_09  // J12-7
170
+#define ENET_CRS           P1_08  // J12-9
171
+#define ENET_TX_EN         P1_04  // J12-10
172
+#define ENET_TXD0          P1_00  // J12-11
173
+#define ENET_TXD1          P1_01  // J12-12
174 174
 
175 175
 /**
176 176
  *  PWMs
@@ -180,17 +180,17 @@
180 180
  *  SERVO2 does NOT have a PWM assigned to it.
181 181
  *
182 182
  *  PWM1.1   P1_18   SERVO3_PIN       FIL_RUNOUT_PIN   5V output, PWM
183
- *  PWM1.1   P2_0    E0_STEP_PIN
183
+ *  PWM1.1   P2_00   E0_STEP_PIN
184 184
  *  PWM1.2   P1_20   SERVO0_PIN
185
- *  PWM1.2   P2_1    X_STEP_PIN
185
+ *  PWM1.2   P2_01   X_STEP_PIN
186 186
  *  PWM1.3   P1_21   SERVO1_PIN       J5-1
187
- *  PWM1.3   P2_2    Y_STEP_PIN
187
+ *  PWM1.3   P2_02   Y_STEP_PIN
188 188
  *  PWM1.4   P1_23   SDSS(SSEL0)      J3-5  AUX-3
189
- *  PWM1.4   P2_3    Z_STEP_PIN
189
+ *  PWM1.4   P2_03   Z_STEP_PIN
190 190
  *  PWM1.5   P1_24   X_MIN_PIN        10K PULLUP TO 3.3v, 1K SERIES
191
- *  PWM1.5   P2_4    RAMPS_D9_PIN
191
+ *  PWM1.5   P2_04   RAMPS_D9_PIN
192 192
  *  PWM1.6   P1_26   Y_MIN_PIN        10K PULLUP TO 3.3v, 1K SERIES
193
- *  PWM1.6   P2_5    RAMPS_D10_PIN
193
+ *  PWM1.6   P2_05   RAMPS_D10_PIN
194 194
  */
195 195
 
196 196
  /**

+ 24
- 24
Marlin/src/pins/pins_RAMPS_RE_ARM.h 查看文件

@@ -65,27 +65,27 @@
65 65
 //
66 66
 // Steppers
67 67
 //
68
-#define X_STEP_PIN         P2_1   // (54)
68
+#define X_STEP_PIN         P2_01  // (54)
69 69
 #define X_DIR_PIN          P0_11  // (55)
70 70
 #define X_ENABLE_PIN       P0_10  // (38)
71 71
 
72
-#define Y_STEP_PIN         P2_2   // (60)
72
+#define Y_STEP_PIN         P2_02  // (60)
73 73
 #define Y_DIR_PIN          P0_20  // (61)
74 74
 #define Y_ENABLE_PIN       P0_19  // (56)
75 75
 
76
-#define Z_STEP_PIN         P2_3   // (46)
76
+#define Z_STEP_PIN         P2_03  // (46)
77 77
 #define Z_DIR_PIN          P0_22  // (48)
78 78
 #define Z_ENABLE_PIN       P0_21  // (62)
79 79
 
80
-#define E0_STEP_PIN        P2_0   // (26)
81
-#define E0_DIR_PIN         P0_5   // (28)
82
-#define E0_ENABLE_PIN      P0_4   // (24)
80
+#define E0_STEP_PIN        P2_00  // (26)
81
+#define E0_DIR_PIN         P0_05  // (28)
82
+#define E0_ENABLE_PIN      P0_04  // (24)
83 83
 
84
-#define E1_STEP_PIN        P2_8   // (36)
84
+#define E1_STEP_PIN        P2_08  // (36)
85 85
 #define E1_DIR_PIN         P2_13  // (34)
86 86
 #define E1_ENABLE_PIN      P4_29  // (30)
87 87
 
88
-#define E2_STEP_PIN        P2_8   // (36)
88
+#define E2_STEP_PIN        P2_08  // (36)
89 89
 #define E2_DIR_PIN         P2_13  // (34)
90 90
 #define E2_ENABLE_PIN      P4_29  // (30)
91 91
 
@@ -127,13 +127,13 @@
127 127
   #define MOSFET_D_PIN   -1
128 128
 #endif
129 129
 #ifndef RAMPS_D8_PIN
130
-  #define RAMPS_D8_PIN   P2_7  // (8)
130
+  #define RAMPS_D8_PIN   P2_07 // (8)
131 131
 #endif
132 132
 #ifndef RAMPS_D9_PIN
133
-  #define RAMPS_D9_PIN   P2_4  // (9)
133
+  #define RAMPS_D9_PIN   P2_04 // (9)
134 134
 #endif
135 135
 #ifndef RAMPS_D10_PIN
136
-  #define RAMPS_D10_PIN  P2_5  // (10)
136
+  #define RAMPS_D10_PIN  P2_05 // (10)
137 137
 #endif
138 138
 
139 139
 #define HEATER_0_PIN     RAMPS_D10_PIN
@@ -198,8 +198,8 @@
198 198
 //
199 199
 // Průša i3 MK2 Multiplexer Support
200 200
 //
201
-#define E_MUX0_PIN         P0_3    // ( 0) Z_CS_PIN
202
-#define E_MUX1_PIN         P0_2    // ( 1) E0_CS_PIN
201
+#define E_MUX0_PIN         P0_03   // ( 0) Z_CS_PIN
202
+#define E_MUX1_PIN         P0_02   // ( 1) E0_CS_PIN
203 203
 #define E_MUX2_PIN         P0_26   // (63) E1_CS_PIN
204 204
 
205 205
 /**
@@ -237,7 +237,7 @@
237 237
   #define LCD_PINS_ENABLE     P0_18  // (51) (MOSI) J3-10 & AUX-3
238 238
   #define LCD_PINS_D4         P0_15  // (52) (SCK)  J3-9 & AUX-3
239 239
 
240
-  #define DOGLCD_A0           P2_6   // (59) J3-8 & AUX-2
240
+  #define DOGLCD_A0           P2_06  // (59) J3-8 & AUX-2
241 241
   #define DOGLCD_CS           P0_26  // (63) J5-3 & AUX-2
242 242
 
243 243
   #ifdef ULTIPANEL
@@ -278,8 +278,8 @@
278 278
     #undef  LCD_PINS_ENABLE     //P0_18  // (51) (MOSI) J3-10 & AUX-3
279 279
     #undef  LCD_PINS_D4         //P0_15  // (52) (SCK)  J3-9 & AUX-3
280 280
 
281
-    #undef  LCD_PINS_D5         //P2_6   // (59) J3-8 & AUX-2
282
-    #define DOGLCD_A0           P2_6   // (59) J3-8 & AUX-2
281
+    #undef  LCD_PINS_D5         //P2_06  // (59) J3-8 & AUX-2
282
+    #define DOGLCD_A0           P2_06  // (59) J3-8 & AUX-2
283 283
     #undef  LCD_PINS_D6         //P0_26  // (63) J5-3 & AUX-2
284 284
     #undef  LCD_PINS_D7         //P1_21  // ( 6) (SERVO1) J5-1 & SERVO connector
285 285
     #define DOGLCD_SCK          SCK_PIN
@@ -315,11 +315,11 @@
315 315
 #endif
316 316
 #define ENET_MOC      P1_16  // (70)  J12-3
317 317
 #define REF_CLK       P1_15  // (72)  J12-5
318
-#define ENET_RXD0     P1_9   // (74)  J12-7
319
-#define ENET_CRS      P1_8   // (76)  J12-9
320
-#define ENET_TX_EN    P1_4   // (77)  J12-10
321
-#define ENET_TXD0     P1_0   // (78)  J12-11
322
-#define ENET_TXD1     P1_1   // (79)  J12-12
318
+#define ENET_RXD0     P1_09  // (74)  J12-7
319
+#define ENET_CRS      P1_08  // (76)  J12-9
320
+#define ENET_TX_EN    P1_04  // (77)  J12-10
321
+#define ENET_TXD0     P1_00  // (78)  J12-11
322
+#define ENET_TXD1     P1_01  // (79)  J12-12
323 323
 
324 324
 /**
325 325
  *  Fast PWMS
@@ -339,8 +339,8 @@
339 339
  *     P1_20 (11)   SERVO0_PIN
340 340
  *     P1_21 ( 6)   SERVO1_PIN       J5-1
341 341
  *     P0_18 ( 4)   SERVO3_PIN       5V output
342
- *    *P2_4  ( 9)   RAMPS_D9_PIN
343
- *    *P2_5  (10)   RAMPS_D10_PIN
342
+ *    *P2_04 ( 9)   RAMPS_D9_PIN
343
+ *    *P2_05 (10)   RAMPS_D10_PIN
344 344
  *
345 345
  *    * - If used as a heater driver then a Fast PWM is NOT assigned.  If used as
346 346
  *        a fan driver then enabling FAST_PWM_FAN assigns a Fast PWM to it.
@@ -375,4 +375,4 @@
375 375
  *  64
376 376
  *  65
377 377
  *  66
378
- */
378
+ */

+ 1
- 1
buildroot/share/pin_interrupt_test/pin_interrupt_test.ino 查看文件

@@ -10,7 +10,7 @@
10 10
 
11 11
 void setup() {
12 12
   Serial.begin(9600);
13
-  Serial.println("PINs causing interrups are:");
13
+  Serial.println("PINs causing interrupts are:");
14 14
   for (int i = 2; i < NUM_DIGITAL_PINS; i++) {
15 15
     if (digitalPinToPCICR(i) || (int)digitalPinToInterrupt(i) != -1) {
16 16
       for (int j = 0; j < NUM_ANALOG_INPUTS; j++) {

Loading…
取消
儲存