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.

HardwareSerial.h 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. */
  16. #ifndef HardwareSerial_h
  17. #define HardwareSerial_h
  18. #include <inttypes.h>
  19. #include "Print.h"
  20. struct ring_buffer;
  21. class HardwareSerial : public Print
  22. {
  23. private:
  24. ring_buffer *_rx_buffer;
  25. volatile uint8_t *_ubrrh;
  26. volatile uint8_t *_ubrrl;
  27. volatile uint8_t *_ucsra;
  28. volatile uint8_t *_ucsrb;
  29. volatile uint8_t *_udr;
  30. uint8_t _rxen;
  31. uint8_t _txen;
  32. uint8_t _rxcie;
  33. uint8_t _udre;
  34. uint8_t _u2x;
  35. public:
  36. HardwareSerial(ring_buffer *rx_buffer,
  37. volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
  38. volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
  39. volatile uint8_t *udr,
  40. uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x);
  41. void begin(long);
  42. void end();
  43. uint8_t available(void);
  44. int read(void);
  45. void flush(void);
  46. virtual void write(uint8_t);
  47. using Print::write; // pull in write(str) and write(buf, size) from Print
  48. };
  49. extern HardwareSerial Serial;
  50. #if defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1280__)
  51. extern HardwareSerial Serial1;
  52. #endif
  53. #if defined(__AVR_ATmega1280__)
  54. extern HardwareSerial Serial2;
  55. extern HardwareSerial Serial3;
  56. #endif
  57. #endif