My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

MarlinSerial.h 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. *
  18. */
  19. #pragma once
  20. #include "../../inc/MarlinConfigPre.h"
  21. #if ENABLED(EMERGENCY_PARSER)
  22. #include "../../feature/e_parser.h"
  23. #endif
  24. typedef void (*usart_rx_callback_t)(serial_t * obj);
  25. class MarlinSerial : public HardwareSerial {
  26. public:
  27. MarlinSerial(void* peripheral, usart_rx_callback_t rx_callback) :
  28. HardwareSerial(peripheral), _rx_callback(rx_callback)
  29. #if ENABLED(EMERGENCY_PARSER)
  30. , emergency_state(EmergencyParser::State::EP_RESET)
  31. #endif
  32. { }
  33. #if ENABLED(EMERGENCY_PARSER)
  34. static inline bool emergency_parser_enabled() { return true; }
  35. #endif
  36. void begin(unsigned long baud, uint8_t config);
  37. inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
  38. void _rx_complete_irq(serial_t* obj);
  39. protected:
  40. usart_rx_callback_t _rx_callback;
  41. #if ENABLED(EMERGENCY_PARSER)
  42. EmergencyParser::State emergency_state;
  43. #endif
  44. };
  45. extern MarlinSerial MSerial1;
  46. extern MarlinSerial MSerial2;
  47. extern MarlinSerial MSerial3;
  48. extern MarlinSerial MSerial4;
  49. extern MarlinSerial MSerial5;
  50. extern MarlinSerial MSerial6;
  51. extern MarlinSerial MSerial7;
  52. extern MarlinSerial MSerial8;
  53. extern MarlinSerial MSerial9;
  54. extern MarlinSerial MSerial10;
  55. extern MarlinSerial MSerialLP1;