My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

MarlinSerial.h 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. HardwareSerial.h - Hardware serial library for Wiring
  3. Copyright (c) 2006 Nicholas Zambetti. All right reserved.
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. Modified 28 September 2010 by Mark Sproul
  16. */
  17. #ifndef MarlinSerial_h
  18. #define MarlinSerial_h
  19. #include <inttypes.h>
  20. #include "Stream.h"
  21. struct ring_buffer;
  22. class MarlinSerial : public Stream
  23. {
  24. private:
  25. ring_buffer *_rx_buffer;
  26. volatile uint8_t *_ubrrh;
  27. volatile uint8_t *_ubrrl;
  28. volatile uint8_t *_ucsra;
  29. volatile uint8_t *_ucsrb;
  30. volatile uint8_t *_udr;
  31. uint8_t _rxen;
  32. uint8_t _txen;
  33. uint8_t _rxcie;
  34. uint8_t _udre;
  35. uint8_t _u2x;
  36. public:
  37. MarlinSerial(ring_buffer *rx_buffer,
  38. volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
  39. volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
  40. volatile uint8_t *udr,
  41. uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x);
  42. void begin(long);
  43. void end();
  44. virtual int available(void);
  45. virtual int peek(void);
  46. virtual int read(void);
  47. virtual void flush(void);
  48. virtual void write(uint8_t);
  49. virtual void checkRx(void);
  50. using Print::write; // pull in write(str) and write(buf, size) from Print
  51. };
  52. #if defined(UBRRH) || defined(UBRR0H)
  53. extern MarlinSerial MSerial;
  54. #endif
  55. #endif