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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 "../../inc/MarlinConfigPre.h"
  24. #include "MarlinSerial.h"
  25. #if ANY_SERIAL_IS(0)
  26. MarlinSerial _MSerial(LPC_UART0);
  27. MSerialT MSerial(true, _MSerial);
  28. extern "C" void UART0_IRQHandler() { _MSerial.IRQHandler(); }
  29. #endif
  30. #if ANY_SERIAL_IS(1)
  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 ANY_SERIAL_IS(2)
  36. MarlinSerial _MSerial2(LPC_UART2);
  37. MSerialT MSerial2(true, _MSerial2);
  38. extern "C" void UART2_IRQHandler() { _MSerial2.IRQHandler(); }
  39. #endif
  40. #if ANY_SERIAL_IS(3)
  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 ANY_SERIAL_IS(0)
  50. else if (this == &_MSerial) emergency_parser.update(MSerial.emergency_state, c);
  51. #endif
  52. #if ANY_SERIAL_IS(1)
  53. else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c);
  54. #endif
  55. #if ANY_SERIAL_IS(2)
  56. else if (this == &_MSerial2) emergency_parser.update(MSerial2.emergency_state, c);
  57. #endif
  58. #if ANY_SERIAL_IS(3)
  59. else if (this == &_MSerial3) emergency_parser.update(MSerial3.emergency_state, c);
  60. #endif
  61. return true;
  62. }
  63. #endif
  64. #endif // TARGET_LPC1768