Browse Source

Try port*100+pin, fix config dependency

Scott Lahteine 7 years ago
parent
commit
3066655727

+ 1
- 1
Marlin/src/HAL/HAL_AVR/MarlinSerial.h View File

@@ -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
 

+ 2
- 6
Marlin/src/HAL/HAL_LPC1768/HAL_LCD_I2C_routines.h View File

@@ -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 View File

@@ -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

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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
 

+ 43
- 22
Marlin/src/HAL/HAL_LPC1768/pinmapping.cpp View File

@@ -22,32 +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
+}
46
+
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);
50
+}
51
+
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
+}
34 61
 
35
-  return -1;
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;
36 65
 }
37 66
 
38
-int16_t PARSED_PIN_INDEX(char code, int16_t dval) {  // treats 1.2 and 1.20 as the same thing
39
-  if (parser.seenval(code)) {
40
-    int port, pin;
41
-    char pin_string[3] = {"  "};
42
-    if (sscanf(parser.strval(code), "%d.%2s", &port, pin_string) == 2) {
43
-      if (pin_string[1] == '\0') pin_string[1] = '0';   // add trailing zero if a null is found
44
-      pin = (10 * (pin_string[0] - '0')) + (pin_string[1] - '0');  // convert string to number
45
-      for (size_t i = 0; i < NUM_DIGITAL_PINS; ++i)
46
-        if (LPC1768_PIN_PORT(pin_map[i]) == port && LPC1768_PIN_PIN(pin_map[i]) == pin)
47
-          return i;
48
-    }
49
-  }
50
-  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;
51 72
 }
52 73
 
53
-#endif // TARGET_LPC1768
74
+#endif // TARGET_LPC1768

+ 80
- 81
Marlin/src/HAL/HAL_LPC1768/pinmapping.h View File

@@ -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,7 +107,7 @@ 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 113
   #define P0_00 LPC1768_PIN(PORT(0), PIN( 0), INTERRUPT(1), PWM(0), ADC_NONE)
@@ -187,97 +188,95 @@ constexpr int8_t LPC1768_PIN_ADC(const pin_t pin) { return (int8_t)((pin >> 10)
187 188
 #define P4_28   LPC1768_PIN(PORT(4), PIN(28), INTERRUPT(0), PWM(0), ADC_NONE)
188 189
 #define P4_29   LPC1768_PIN(PORT(4), PIN(29), INTERRUPT(0), PWM(0), ADC_NONE)
189 190
 
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_03, P0_02
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
-}
241
-
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_06, P0_07, P0_08, P0_09, 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 194
     P0_00, P0_01,
195
+  #else
196
+    P_NC,  P_NC,
254 197
   #endif
255 198
   #if SERIAL_PORT != 0
256
-    P0_02, P0_03,
199
+                  P0_02, P0_03,
200
+  #else
201
+                  P_NC,  P_NC,
257 202
   #endif
258
-  P0_04, P0_05, P0_06, P0_07, P0_08, P0_09,
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_00, P1_01, P1_04, P1_08, P1_09, 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,
225
+
270 226
   P2_00, P2_01, P2_02, P2_03, P2_04, P2_05, P2_06, P2_07,
271
-  P2_08, P2_09, P2_10, P2_11, P2_12, P2_13,
272
-  P3_25, P3_26,
273
-  P4_28, P4_29
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_

+ 3
- 1
Marlin/src/gcode/control/M42.cpp View File

@@ -28,7 +28,9 @@
28 28
  * M42: Change pin status via GCode
29 29
  *
30 30
  *  P<pin>  Pin number (LED if omitted)
31
- *            For LPC1768 enter pin P1_20 as M42 P1.20
31
+ *          For LPC1768 specify pin P1_02 as M42 P102,
32
+ *                                  P1_20 as M42 P120, etc.
33
+ *
32 34
  *  S<byte> Pin status from 0 - 255
33 35
  */
34 36
 void GcodeSuite::M42() {

+ 2
- 7
Marlin/src/inc/MarlinConfig.h View File

@@ -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 View File

@@ -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 View File

@@ -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)

Loading…
Cancel
Save