Browse Source

Evaluate ANY_SERIAL_IS in place

Scott Lahteine 3 years ago
parent
commit
c6ef86029c

+ 4
- 4
Marlin/src/HAL/LPC1768/MarlinSerial.cpp View File

24
 #include "../../inc/MarlinConfigPre.h"
24
 #include "../../inc/MarlinConfigPre.h"
25
 #include "MarlinSerial.h"
25
 #include "MarlinSerial.h"
26
 
26
 
27
-#if USING_SERIAL_0
27
+#if ANY_SERIAL_IS(0)
28
   MSerialT MSerial(true, LPC_UART0);
28
   MSerialT MSerial(true, LPC_UART0);
29
   extern "C" void UART0_IRQHandler() { MSerial.IRQHandler(); }
29
   extern "C" void UART0_IRQHandler() { MSerial.IRQHandler(); }
30
 #endif
30
 #endif
31
-#if USING_SERIAL_1
31
+#if ANY_SERIAL_IS(1)
32
   MSerialT MSerial1(true, (LPC_UART_TypeDef *) LPC_UART1);
32
   MSerialT MSerial1(true, (LPC_UART_TypeDef *) LPC_UART1);
33
   extern "C" void UART1_IRQHandler() { MSerial1.IRQHandler(); }
33
   extern "C" void UART1_IRQHandler() { MSerial1.IRQHandler(); }
34
 #endif
34
 #endif
35
-#if USING_SERIAL_2
35
+#if ANY_SERIAL_IS(2)
36
   MSerialT MSerial2(true, LPC_UART2);
36
   MSerialT MSerial2(true, LPC_UART2);
37
   extern "C" void UART2_IRQHandler() { MSerial2.IRQHandler(); }
37
   extern "C" void UART2_IRQHandler() { MSerial2.IRQHandler(); }
38
 #endif
38
 #endif
39
-#if USING_SERIAL_3
39
+#if ANY_SERIAL_IS(3)
40
   MSerialT MSerial3(true, LPC_UART3);
40
   MSerialT MSerial3(true, LPC_UART3);
41
   extern "C" void UART3_IRQHandler() { MSerial3.IRQHandler(); }
41
   extern "C" void UART3_IRQHandler() { MSerial3.IRQHandler(); }
42
 #endif
42
 #endif

+ 4
- 4
Marlin/src/HAL/LPC1768/inc/SanityCheck.h View File

92
 #define ANY_TX(N,V...) DO(IS_TX##N,||,V)
92
 #define ANY_TX(N,V...) DO(IS_TX##N,||,V)
93
 #define ANY_RX(N,V...) DO(IS_RX##N,||,V)
93
 #define ANY_RX(N,V...) DO(IS_RX##N,||,V)
94
 
94
 
95
-#if USING_SERIAL_0
95
+#if ANY_SERIAL_IS(0)
96
   #define IS_TX0(P) (P == P0_02)
96
   #define IS_TX0(P) (P == P0_02)
97
   #define IS_RX0(P) (P == P0_03)
97
   #define IS_RX0(P) (P == P0_03)
98
   #if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI)
98
   #if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI)
106
   #undef IS_RX0
106
   #undef IS_RX0
107
 #endif
107
 #endif
108
 
108
 
109
-#if USING_SERIAL_1
109
+#if ANY_SERIAL_IS(1)
110
   #define IS_TX1(P) (P == P0_15)
110
   #define IS_TX1(P) (P == P0_15)
111
   #define IS_RX1(P) (P == P0_16)
111
   #define IS_RX1(P) (P == P0_16)
112
   #define _IS_TX1_1 IS_TX1
112
   #define _IS_TX1_1 IS_TX1
127
   #undef _IS_RX1_1
127
   #undef _IS_RX1_1
128
 #endif
128
 #endif
129
 
129
 
130
-#if USING_SERIAL_2
130
+#if ANY_SERIAL_IS(2)
131
   #define IS_TX2(P) (P == P0_10)
131
   #define IS_TX2(P) (P == P0_10)
132
   #define IS_RX2(P) (P == P0_11)
132
   #define IS_RX2(P) (P == P0_11)
133
   #define _IS_TX2_1 IS_TX2
133
   #define _IS_TX2_1 IS_TX2
161
   #undef _IS_RX2_1
161
   #undef _IS_RX2_1
162
 #endif
162
 #endif
163
 
163
 
164
-#if USING_SERIAL_3
164
+#if ANY_SERIAL_IS(3)
165
   #define PIN_IS_TX3(P) (PIN_EXISTS(P) && P##_PIN == P0_00)
165
   #define PIN_IS_TX3(P) (PIN_EXISTS(P) && P##_PIN == P0_00)
166
   #define PIN_IS_RX3(P) (P##_PIN == P0_01)
166
   #define PIN_IS_RX3(P) (P##_PIN == P0_01)
167
   #if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
167
   #if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)

+ 3
- 3
Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.cpp View File

27
 
27
 
28
 #include "../../inc/MarlinConfig.h"
28
 #include "../../inc/MarlinConfig.h"
29
 
29
 
30
-#if USING_SERIAL_1
30
+#if ANY_SERIAL_IS(1)
31
   UartT Serial2(false, &sercom4, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX);
31
   UartT Serial2(false, &sercom4, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX);
32
   void SERCOM4_0_Handler() { Serial2.IrqHandler(); }
32
   void SERCOM4_0_Handler() { Serial2.IrqHandler(); }
33
   void SERCOM4_1_Handler() { Serial2.IrqHandler(); }
33
   void SERCOM4_1_Handler() { Serial2.IrqHandler(); }
35
   void SERCOM4_3_Handler() { Serial2.IrqHandler(); }
35
   void SERCOM4_3_Handler() { Serial2.IrqHandler(); }
36
 #endif
36
 #endif
37
 
37
 
38
-#if USING_SERIAL_2
38
+#if ANY_SERIAL_IS(2)
39
   UartT Serial3(false, &sercom1, PIN_SERIAL3_RX, PIN_SERIAL3_TX, PAD_SERIAL3_RX, PAD_SERIAL3_TX);
39
   UartT Serial3(false, &sercom1, PIN_SERIAL3_RX, PIN_SERIAL3_TX, PAD_SERIAL3_RX, PAD_SERIAL3_TX);
40
   void SERCOM1_0_Handler() { Serial3.IrqHandler(); }
40
   void SERCOM1_0_Handler() { Serial3.IrqHandler(); }
41
   void SERCOM1_1_Handler() { Serial3.IrqHandler(); }
41
   void SERCOM1_1_Handler() { Serial3.IrqHandler(); }
43
   void SERCOM1_3_Handler() { Serial3.IrqHandler(); }
43
   void SERCOM1_3_Handler() { Serial3.IrqHandler(); }
44
 #endif
44
 #endif
45
 
45
 
46
-#if USING_SERIAL_3
46
+#if ANY_SERIAL_IS(3)
47
   UartT Serial4(false, &sercom5, PIN_SERIAL4_RX, PIN_SERIAL4_TX, PAD_SERIAL4_RX, PAD_SERIAL4_TX);
47
   UartT Serial4(false, &sercom5, PIN_SERIAL4_RX, PIN_SERIAL4_TX, PAD_SERIAL4_RX, PAD_SERIAL4_TX);
48
   void SERCOM5_0_Handler() { Serial4.IrqHandler(); }
48
   void SERCOM5_0_Handler() { Serial4.IrqHandler(); }
49
   void SERCOM5_1_Handler() { Serial4.IrqHandler(); }
49
   void SERCOM5_1_Handler() { Serial4.IrqHandler(); }

+ 0
- 31
Marlin/src/inc/Conditionals_adv.h View File

516
                          (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == (N)) || \
516
                          (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == (N)) || \
517
                          (defined(MMU2_SERIAL_PORT) && MMU2_SERIAL_PORT == (N)) || \
517
                          (defined(MMU2_SERIAL_PORT) && MMU2_SERIAL_PORT == (N)) || \
518
                          (defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT == (N))
518
                          (defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT == (N))
519
-#if ANY_SERIAL_IS(-1)
520
-  #define USING_SERIAL_DEFAULT
521
-#endif
522
-#if ANY_SERIAL_IS(0)
523
-  #define USING_SERIAL_0 1
524
-#endif
525
-#if ANY_SERIAL_IS(1)
526
-  #define USING_SERIAL_1 1
527
-#endif
528
-#if ANY_SERIAL_IS(2)
529
-  #define USING_SERIAL_2 1
530
-#endif
531
-#if ANY_SERIAL_IS(3)
532
-  #define USING_SERIAL_3 1
533
-#endif
534
-#if ANY_SERIAL_IS(4)
535
-  #define USING_SERIAL_4 1
536
-#endif
537
-#if ANY_SERIAL_IS(5)
538
-  #define USING_SERIAL_5 1
539
-#endif
540
-#if ANY_SERIAL_IS(6)
541
-  #define USING_SERIAL_6 1
542
-#endif
543
-#if ANY_SERIAL_IS(7)
544
-  #define USING_SERIAL_7 1
545
-#endif
546
-#if ANY_SERIAL_IS(8)
547
-  #define USING_SERIAL_8 1
548
-#endif
549
-#undef ANY_SERIAL_IS

Loading…
Cancel
Save