My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

HardwareSerial.h 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 HardwareSerial_h
  18. #define HardwareSerial_h
  19. #include <inttypes.h>
  20. #include "Stream.h"
  21. struct ring_buffer;
  22. class HardwareSerial : 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. HardwareSerial(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. using Print::write; // pull in write(str) and write(buf, size) from Print
  50. };
  51. #if defined(UBRRH) || defined(UBRR0H)
  52. extern HardwareSerial Serial;
  53. #elif defined(USBCON)
  54. #include "usb_api.h"
  55. #endif
  56. #if defined(UBRR1H)
  57. extern HardwareSerial Serial1;
  58. #endif
  59. #if defined(UBRR2H)
  60. extern HardwareSerial Serial2;
  61. #endif
  62. #if defined(UBRR3H)
  63. extern HardwareSerial Serial3;
  64. #endif
  65. #endif