My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MarlinSerial.cpp 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #ifdef TARGET_LPC1768
  23. #include "MarlinSerial.h"
  24. #include "../../inc/MarlinConfig.h"
  25. #if USING_HW_SERIAL0
  26. MarlinSerial _MSerial0(LPC_UART0);
  27. MSerialT MSerial0(true, _MSerial0);
  28. extern "C" void UART0_IRQHandler() { _MSerial0.IRQHandler(); }
  29. #endif
  30. #if USING_HW_SERIAL1
  31. MarlinSerial _MSerial1((LPC_UART_TypeDef *) LPC_UART1);
  32. MSerialT MSerial1(true, _MSerial1);
  33. extern "C" void UART1_IRQHandler() { _MSerial1.IRQHandler(); }
  34. #endif
  35. #if USING_HW_SERIAL2
  36. MarlinSerial _MSerial2(LPC_UART2);
  37. MSerialT MSerial2(true, _MSerial2);
  38. extern "C" void UART2_IRQHandler() { _MSerial2.IRQHandler(); }
  39. #endif
  40. #if USING_HW_SERIAL3
  41. MarlinSerial _MSerial3(LPC_UART3);
  42. MSerialT MSerial3(true, _MSerial3);
  43. extern "C" void UART3_IRQHandler() { _MSerial3.IRQHandler(); }
  44. #endif
  45. #if ENABLED(EMERGENCY_PARSER)
  46. bool MarlinSerial::recv_callback(const char c) {
  47. // Need to figure out which serial port we are and react in consequence (Marlin does not have CONTAINER_OF macro)
  48. if (false) {}
  49. #if USING_HW_SERIAL0
  50. else if (this == &_MSerial0) emergency_parser.update(MSerial0.emergency_state, c);
  51. #endif
  52. #if USING_HW_SERIAL1
  53. else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c);
  54. #endif
  55. #if USING_HW_SERIAL2
  56. else if (this == &_MSerial2) emergency_parser.update(MSerial2.emergency_state, c);
  57. #endif
  58. #if USING_HW_SERIAL3
  59. else if (this == &_MSerial3) emergency_parser.update(MSerial3.emergency_state, c);
  60. #endif
  61. return true;
  62. }
  63. #endif
  64. #endif // TARGET_LPC1768