Fix and improve STM32F1 serial (#19464)
This commit is contained in:
@ -85,13 +85,13 @@ extern "C" volatile uint32_t _millis;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DGUS_SERIAL_PORT
|
||||
#if DGUS_SERIAL_PORT == -1
|
||||
#define DGUS_SERIAL UsbSerial
|
||||
#elif WITHIN(DGUS_SERIAL_PORT, 0, 3)
|
||||
#define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
|
||||
#ifdef LCD_SERIAL_PORT
|
||||
#if LCD_SERIAL_PORT == -1
|
||||
#define LCD_SERIAL UsbSerial
|
||||
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
|
||||
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
|
||||
#else
|
||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -24,28 +24,28 @@
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
#include "MarlinSerial.h"
|
||||
|
||||
#if (defined(SERIAL_PORT) && SERIAL_PORT == 0) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 0) || (defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT == 0)
|
||||
#if USING_SERIAL_0
|
||||
MarlinSerial MSerial(LPC_UART0);
|
||||
extern "C" void UART0_IRQHandler() {
|
||||
MSerial.IRQHandler();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 || DGUS_SERIAL_PORT == 1
|
||||
#if USING_SERIAL_1
|
||||
MarlinSerial MSerial1((LPC_UART_TypeDef *) LPC_UART1);
|
||||
extern "C" void UART1_IRQHandler() {
|
||||
MSerial1.IRQHandler();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 || DGUS_SERIAL_PORT == 2
|
||||
#if USING_SERIAL_2
|
||||
MarlinSerial MSerial2(LPC_UART2);
|
||||
extern "C" void UART2_IRQHandler() {
|
||||
MSerial2.IRQHandler();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 || DGUS_SERIAL_PORT == 3
|
||||
#if USING_SERIAL_3
|
||||
MarlinSerial MSerial3(LPC_UART3);
|
||||
extern "C" void UART3_IRQHandler() {
|
||||
MSerial3.IRQHandler();
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
}
|
||||
|
||||
EmergencyParser::State emergency_state;
|
||||
static inline bool emergency_parser_enabled() { return true; }
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -92,7 +92,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||
#define ANY_TX(N,V...) DO(IS_TX##N,||,V)
|
||||
#define ANY_RX(N,V...) DO(IS_RX##N,||,V)
|
||||
|
||||
#if (defined(SERIAL_PORT) && SERIAL_PORT == 0) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 0) || (defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT == 0)
|
||||
#if USING_SERIAL_0
|
||||
#define IS_TX0(P) (P == P0_02)
|
||||
#define IS_RX0(P) (P == P0_03)
|
||||
#if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI)
|
||||
@ -106,7 +106,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||
#undef IS_RX0
|
||||
#endif
|
||||
|
||||
#if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 || DGUS_SERIAL_PORT == 1
|
||||
#if USING_SERIAL_1
|
||||
#define IS_TX1(P) (P == P0_15)
|
||||
#define IS_RX1(P) (P == P0_16)
|
||||
#define _IS_TX1_1 IS_TX1
|
||||
@ -127,7 +127,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||
#undef _IS_RX1_1
|
||||
#endif
|
||||
|
||||
#if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 || DGUS_SERIAL_PORT == 2
|
||||
#if USING_SERIAL_2
|
||||
#define IS_TX2(P) (P == P0_10)
|
||||
#define IS_RX2(P) (P == P0_11)
|
||||
#define _IS_TX2_1 IS_TX2
|
||||
@ -161,7 +161,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||
#undef _IS_RX2_1
|
||||
#endif
|
||||
|
||||
#if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 || DGUS_SERIAL_PORT == 3
|
||||
#if USING_SERIAL_3
|
||||
#define PIN_IS_TX3(P) (PIN_EXISTS(P) && P##_PIN == P0_00)
|
||||
#define PIN_IS_RX3(P) (P##_PIN == P0_01)
|
||||
#if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
|
||||
|
@ -26,7 +26,9 @@
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
|
||||
#include "../../feature/e_parser.h"
|
||||
|
||||
EmergencyParser::State emergency_state;
|
||||
|
||||
bool CDC_RecvCallback(const char buffer) {
|
||||
emergency_parser.update(emergency_state, buffer);
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user