File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
hardware/arduino/avr/cores/arduino Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ size_t Print::print(const Printable& x)
125
125
126
126
size_t Print::println (void )
127
127
{
128
- return write (" \r\n " );
128
+ return write (line_ending );
129
129
}
130
130
131
131
size_t Print::println (const String &s)
@@ -198,6 +198,10 @@ size_t Print::println(const Printable& x)
198
198
return n;
199
199
}
200
200
201
+ void Print::set_line_ending (const char * ending){
202
+ line_ending = ending;
203
+ }
204
+
201
205
// Private Methods /////////////////////////////////////////////////////////////
202
206
203
207
size_t Print::printNumber (unsigned long n, uint8_t base)
Original file line number Diff line number Diff line change @@ -40,11 +40,14 @@ class Print
40
40
int write_error;
41
41
size_t printNumber (unsigned long , uint8_t );
42
42
size_t printFloat (double , uint8_t );
43
+ const char * line_ending;
43
44
protected:
44
45
void setWriteError (int err = 1 ) { write_error = err; }
45
46
public:
46
- Print () : write_error(0 ) {}
47
-
47
+ Print () : write_error(0 ) {
48
+ line_ending = " \r\n " ;
49
+ }
50
+
48
51
int getWriteError () { return write_error; }
49
52
void clearWriteError () { setWriteError (0 ); }
50
53
@@ -87,6 +90,8 @@ class Print
87
90
size_t println (const Printable&);
88
91
size_t println (void );
89
92
93
+ void set_line_ending (const char * ending);
94
+
90
95
virtual void flush () { /* Empty implementation for backward compatibility */ }
91
96
};
92
97
You can’t perform that action at this time.
0 commit comments