File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,26 @@ size_t Print::println(const Printable &x)
196
196
return n;
197
197
}
198
198
199
+ void Print::printf (const char *format, ...)
200
+ {
201
+ char buf[PRINTF_BUFFER];
202
+ va_list ap;
203
+ va_start (ap, format);
204
+ vsnprintf (buf, sizeof (buf), format, ap);
205
+ write (buf);
206
+ va_end (ap);
207
+ }
208
+
209
+ void Print::printf (const __FlashStringHelper *format, ...)
210
+ {
211
+ char buf[PRINTF_BUFFER];
212
+ va_list ap;
213
+ va_start (ap, format);
214
+ vsnprintf_P (buf, sizeof (buf), (const char *)format, ap);
215
+ write (buf);
216
+ va_end (ap);
217
+ }
218
+
199
219
// Private Methods /////////////////////////////////////////////////////////////
200
220
201
221
size_t Print::printNumber (unsigned long n, uint8_t base)
Original file line number Diff line number Diff line change 22
22
23
23
#include < inttypes.h>
24
24
#include < stdio.h> // for size_t
25
+ #include < stdarg.h> // for printf
25
26
26
27
#include " WString.h"
27
28
#include " Printable.h"
31
32
#define OCT 8
32
33
#define BIN 2
33
34
35
+ #ifndef PRINTF_BUFFER
36
+ #define PRINTF_BUFFER 80
37
+ #endif
38
+
34
39
// uncomment next line to support printing of 64 bit ints.
35
40
#define SUPPORT_LONGLONG
36
41
@@ -103,6 +108,9 @@ class Print {
103
108
void println (uint64_t , uint8_t = DEC);
104
109
void print (uint64_t , uint8_t = DEC);
105
110
#endif
111
+
112
+ void printf (const char *format, ...);
113
+ void printf (const __FlashStringHelper *format, ...);
106
114
};
107
115
108
116
#endif
You can’t perform that action at this time.
0 commit comments