|
@@ -51,13 +51,15 @@ class MarlinSerial //: public Stream
|
51
|
51
|
MarlinSerial();
|
52
|
52
|
void begin(long);
|
53
|
53
|
void end();
|
|
54
|
+ int peek(void);
|
|
55
|
+ int read(void);
|
|
56
|
+ void flush(void);
|
|
57
|
+
|
54
|
58
|
inline int available(void)
|
55
|
59
|
{
|
56
|
60
|
return (unsigned int)(RX_BUFFER_SIZE + rx_buffer.head - rx_buffer.tail) % RX_BUFFER_SIZE;
|
57
|
61
|
}
|
58
|
|
- int peek(void);
|
59
|
|
- int read(void);
|
60
|
|
- void flush(void);
|
|
62
|
+
|
61
|
63
|
inline void write(uint8_t c)
|
62
|
64
|
{
|
63
|
65
|
while (!((UCSR0A) & (1 << UDRE0)))
|
|
@@ -91,11 +93,31 @@ class MarlinSerial //: public Stream
|
91
|
93
|
|
92
|
94
|
|
93
|
95
|
public:
|
94
|
|
- void write(const char *str);
|
95
|
|
- void write( const uint8_t *buffer, size_t size);
|
96
|
96
|
|
97
|
|
- void print(const String &);
|
98
|
|
- void print(const char[]);
|
|
97
|
+ inline void write(const char *str)
|
|
98
|
+ {
|
|
99
|
+ while (*str)
|
|
100
|
+ write(*str++);
|
|
101
|
+ }
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+ inline void write(const uint8_t *buffer, size_t size)
|
|
105
|
+ {
|
|
106
|
+ while (size--)
|
|
107
|
+ write(*buffer++);
|
|
108
|
+ }
|
|
109
|
+
|
|
110
|
+ inline void print(const String &s)
|
|
111
|
+ {
|
|
112
|
+ for (int i = 0; i < s.length(); i++) {
|
|
113
|
+ write(s[i]);
|
|
114
|
+ }
|
|
115
|
+ }
|
|
116
|
+
|
|
117
|
+ inline void print(const char *str)
|
|
118
|
+ {
|
|
119
|
+ write(str);
|
|
120
|
+ }
|
99
|
121
|
void print(char, int = BYTE);
|
100
|
122
|
void print(unsigned char, int = BYTE);
|
101
|
123
|
void print(int, int = DEC);
|