Browse Source

Define UART pins for LPC debug based on LPC_PINCFG_UART (#19475)

ellensp 4 years ago
parent
commit
6634bedb25
No account linked to committer's email address
3 changed files with 73 additions and 29 deletions
  1. 11
    5
      Marlin/src/HAL/AVR/fastio.h
  2. 3
    1
      Marlin/src/HAL/AVR/pinsDebug.h
  3. 59
    23
      Marlin/src/pins/pinsDebug.h

+ 11
- 5
Marlin/src/HAL/AVR/fastio.h View File

@@ -29,11 +29,17 @@
29 29
 
30 30
 #include <avr/io.h>
31 31
 
32
-#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__))
33
-#define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__))
34
-#define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__))
35
-#define AVR_ATmega2561_FAMILY (defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__))
36
-#define AVR_ATmega328_FAMILY (defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__))
32
+#if defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__)
33
+  #define AVR_AT90USB1286_FAMILY 1
34
+#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__)
35
+  #define AVR_ATmega1284_FAMILY 1
36
+#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
37
+  #define AVR_ATmega2560_FAMILY 1
38
+#elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
39
+  #define AVR_ATmega2561_FAMILY 1
40
+#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__)
41
+  #define AVR_ATmega328_FAMILY 1
42
+#endif
37 43
 
38 44
 /**
39 45
  * Include Ports and Functions

+ 3
- 1
Marlin/src/HAL/AVR/pinsDebug.h View File

@@ -26,7 +26,9 @@
26 26
 
27 27
 #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
28 28
 
29
-#define AVR_ATmega2560_FAMILY_PLUS_70 MB(BQ_ZUM_MEGA_3D, MIGHTYBOARD_REVE, MINIRAMBO, SCOOVO_X9H)
29
+#if MB(BQ_ZUM_MEGA_3D, MIGHTYBOARD_REVE, MINIRAMBO, SCOOVO_X9H)
30
+  #define AVR_ATmega2560_FAMILY_PLUS_70 1
31
+#endif
30 32
 
31 33
 #if AVR_AT90USB1286_FAMILY
32 34
 

+ 59
- 23
Marlin/src/pins/pinsDebug.h View File

@@ -45,7 +45,7 @@
45 45
 #line 46
46 46
 
47 47
 // manually add pins that have names that are macros which don't play well with these macros
48
-#if (AVR_ATmega2560_FAMILY || AVR_ATmega1284_FAMILY || defined(ARDUINO_ARCH_SAM) || defined(TARGET_LPC1768))
48
+#if ANY(AVR_ATmega2560_FAMILY, AVR_ATmega1284_FAMILY, ARDUINO_ARCH_SAM, TARGET_LPC1768)
49 49
   #if SERIAL_PORT == 0
50 50
     static const char RXD_NAME_0[] PROGMEM = { "RXD0" };
51 51
     static const char TXD_NAME_0[] PROGMEM = { "TXD0" };
@@ -110,83 +110,119 @@ const PinInfo pin_array[] PROGMEM = {
110 110
 
111 111
   // manually add pins ...
112 112
   #if SERIAL_PORT == 0
113
-    #if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
113
+    #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
114 114
       { RXD_NAME_0, 0, true },
115 115
       { TXD_NAME_0, 1, true },
116 116
     #elif AVR_ATmega1284_FAMILY
117 117
       { RXD_NAME_0, 8, true },
118 118
       { TXD_NAME_0, 9, true },
119
-    #elif defined(TARGET_LPC1768)
119
+    #elif defined(TARGET_LPC1768)           // TX P0_02  RX P0_03
120 120
       { RXD_NAME_0, 3, true },
121 121
       { TXD_NAME_0, 2, true },
122 122
     #endif
123 123
   #elif SERIAL_PORT == 1
124
-    #if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
124
+    #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
125 125
       { RXD_NAME_1, 19, true },
126 126
       { TXD_NAME_1, 18, true },
127 127
     #elif AVR_ATmega1284_FAMILY
128 128
       { RXD_NAME_1, 10, true },
129 129
       { TXD_NAME_1, 11, true },
130 130
     #elif defined(TARGET_LPC1768)
131
-      { RXD_NAME_1, 16, true },
132
-      { TXD_NAME_1, 15, true },
131
+      #ifdef LPC_PINCFG_UART1_P2_00         // TX P2_00  RX P2_01
132
+        { RXD_NAME_1, 0x41, true },
133
+        { TXD_NAME_1, 0x40, true },
134
+      #else                                 // TX P0_15  RX P0_16
135
+        { RXD_NAME_1, 16, true },
136
+        { TXD_NAME_1, 15, true },
137
+      #endif
133 138
     #endif
134 139
   #elif SERIAL_PORT == 2
135
-    #if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
140
+    #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
136 141
       { RXD_NAME_2, 17, true },
137 142
       { TXD_NAME_2, 16, true },
138 143
     #elif defined(TARGET_LPC1768)
139
-      { RXD_NAME_2, 11, true },
140
-      { TXD_NAME_2, 10, true },
144
+      #ifdef LPC_PINCFG_UART2_P2_08         // TX P2_08  RX P2_09
145
+        { RXD_NAME_2, 0x49, true },
146
+        { TXD_NAME_2, 0x48, true },
147
+      #else                                 // TX P0_10  RX P0_11
148
+        { RXD_NAME_2, 11, true },
149
+        { TXD_NAME_2, 10, true },
150
+      #endif
141 151
     #endif
142 152
   #elif SERIAL_PORT == 3
143
-    #if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
153
+    #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
144 154
       { RXD_NAME_3, 15, true },
145 155
       { TXD_NAME_3, 14, true },
146 156
     #elif defined(TARGET_LPC1768)
147
-      { RXD_NAME_3, 1, true },
148
-      { TXD_NAME_3, 0, true },
157
+      #ifdef LPC_PINCFG_UART3_P0_25         // TX P0_25  RX P0_26
158
+        { RXD_NAME_3, 0x1A, true },
159
+        { TXD_NAME_3, 0x19, true },
160
+      #elif defined(LPC_PINCFG_UART3_P4_28) // TX P4_28  RX P4_29
161
+        { RXD_NAME_3, 0x9D, true },
162
+        { TXD_NAME_3, 0x9C, true },
163
+      #else                                 // TX P0_00  RX P0_01
164
+        { RXD_NAME_3, 1, true },
165
+        { TXD_NAME_3, 0, true },
166
+      #endif
149 167
     #endif
150 168
   #endif
151 169
 
152 170
   #ifdef SERIAL_PORT_2
153 171
     #if SERIAL_PORT_2 == 0
154
-      #if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
172
+      #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
155 173
         { RXD_NAME_0, 0, true },
156 174
         { TXD_NAME_0, 1, true },
157 175
       #elif AVR_ATmega1284_FAMILY
158 176
         { RXD_NAME_0, 8, true },
159 177
         { TXD_NAME_0, 9, true },
160
-      #elif defined(TARGET_LPC1768)
178
+      #elif defined(TARGET_LPC1768)           // TX P0_02  RX P0_03
161 179
         { RXD_NAME_0, 3, true },
162 180
         { TXD_NAME_0, 2, true },
163 181
       #endif
164 182
     #elif SERIAL_PORT_2 == 1
165
-      #if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
183
+      #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
166 184
         { RXD_NAME_1, 19, true },
167 185
         { TXD_NAME_1, 18, true },
168 186
       #elif AVR_ATmega1284_FAMILY
169 187
         { RXD_NAME_1, 10, true },
170 188
         { TXD_NAME_1, 11, true },
171 189
       #elif defined(TARGET_LPC1768)
172
-        { RXD_NAME_1, 16, true },
173
-        { TXD_NAME_1, 15, true },
190
+        #ifdef LPC_PINCFG_UART1_P2_00         // TX P2_00  RX P2_01
191
+          { RXD_NAME_1, 0x41, true },
192
+          { TXD_NAME_1, 0x40, true },
193
+        #else                                 // TX P0_15  RX P0_16
194
+          { RXD_NAME_1, 16, true },
195
+          { TXD_NAME_1, 15, true },
196
+        #endif
174 197
       #endif
175 198
     #elif SERIAL_PORT_2 == 2
176
-      #if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
199
+      #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
177 200
         { RXD_NAME_2, 17, true },
178 201
         { TXD_NAME_2, 16, true },
179 202
       #elif defined(TARGET_LPC1768)
180
-        { RXD_NAME_2, 11, true },
181
-        { TXD_NAME_2, 10, true },
203
+        #ifdef LPC_PINCFG_UART2_P2_08         // TX P2_08  RX P2_09
204
+          { RXD_NAME_2, 0x49, true },
205
+          { TXD_NAME_2, 0x48, true },
206
+        #else                                 // TX P0_10  RX P0_11
207
+          { RXD_NAME_2, 11, true },
208
+          { TXD_NAME_2, 10, true },
209
+        #endif
182 210
       #endif
183 211
     #elif SERIAL_PORT_2 == 3
184
-      #if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
212
+      #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
185 213
         { RXD_NAME_3, 15, true },
186 214
         { TXD_NAME_3, 14, true },
187 215
       #elif defined(TARGET_LPC1768)
188
-        { RXD_NAME_3, 1, true },
189
-        { TXD_NAME_3, 0, true },
216
+        #ifdef LPC_PINCFG_UART3_P0_25         // TX P0_25  RX P0_26
217
+          { RXD_NAME_3, 0x1A, true },
218
+          { TXD_NAME_3, 0x19, true },
219
+        #elif defined(LPC_PINCFG_UART3_P4_28) // TX P4_28  RX P4_29
220
+          { RXD_NAME_3, 0x9D, true },
221
+          { TXD_NAME_3, 0x9C, true },
222
+        #else                                 // TX P0_00  RX P0_01
223
+          { RXD_NAME_3, 1, true },
224
+          { TXD_NAME_3, 0, true },
225
+        #endif
190 226
       #endif
191 227
     #endif
192 228
   #endif

Loading…
Cancel
Save