Combined LPC / Serial fixes (#21178)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
@@ -25,20 +25,46 @@
|
||||
#include "MarlinSerial.h"
|
||||
|
||||
#if ANY_SERIAL_IS(0)
|
||||
MSerialT MSerial(true, LPC_UART0);
|
||||
extern "C" void UART0_IRQHandler() { MSerial.IRQHandler(); }
|
||||
MarlinSerial _MSerial(LPC_UART0);
|
||||
MSerialT MSerial(true, _MSerial);
|
||||
extern "C" void UART0_IRQHandler() { _MSerial.IRQHandler(); }
|
||||
#endif
|
||||
#if ANY_SERIAL_IS(1)
|
||||
MSerialT MSerial1(true, (LPC_UART_TypeDef *) LPC_UART1);
|
||||
extern "C" void UART1_IRQHandler() { MSerial1.IRQHandler(); }
|
||||
MarlinSerial _MSerial1((LPC_UART_TypeDef *) LPC_UART1);
|
||||
MSerialT MSerial1(true, _MSerial1);
|
||||
extern "C" void UART1_IRQHandler() { _MSerial1.IRQHandler(); }
|
||||
#endif
|
||||
#if ANY_SERIAL_IS(2)
|
||||
MSerialT MSerial2(true, LPC_UART2);
|
||||
extern "C" void UART2_IRQHandler() { MSerial2.IRQHandler(); }
|
||||
MarlinSerial _MSerial2(LPC_UART2);
|
||||
MSerialT MSerial2(true, _MSerial2);
|
||||
extern "C" void UART2_IRQHandler() { _MSerial2.IRQHandler(); }
|
||||
#endif
|
||||
#if ANY_SERIAL_IS(3)
|
||||
MSerialT MSerial3(true, LPC_UART3);
|
||||
extern "C" void UART3_IRQHandler() { MSerial3.IRQHandler(); }
|
||||
MarlinSerial _MSerial3(LPC_UART3);
|
||||
MSerialT MSerial3(true, _MSerial3);
|
||||
extern "C" void UART3_IRQHandler() { _MSerial3.IRQHandler(); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
|
||||
bool MarlinSerial::recv_callback(const char c) {
|
||||
// Need to figure out which serial port we are and react in consequence (Marlin does not have CONTAINER_OF macro)
|
||||
if (false) {}
|
||||
#if ANY_SERIAL_IS(0)
|
||||
else if (this == &_MSerial) emergency_parser.update(MSerial.emergency_state, c);
|
||||
#endif
|
||||
#if ANY_SERIAL_IS(1)
|
||||
else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c);
|
||||
#endif
|
||||
#if ANY_SERIAL_IS(2)
|
||||
else if (this == &_MSerial2) emergency_parser.update(MSerial2.emergency_state, c);
|
||||
#endif
|
||||
#if ANY_SERIAL_IS(3)
|
||||
else if (this == &_MSerial3) emergency_parser.update(MSerial3.emergency_state, c);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // TARGET_LPC1768
|
||||
|
||||
Reference in New Issue
Block a user