Skip to content

Commit fbdccf8

Browse files
committed
Fix Print::printf implementation
1 parent 893df5c commit fbdccf8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cores/nRF5/Print.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <string.h>
2323
#include <math.h>
2424
#include "Arduino.h"
25+
#include "printf.h"
2526

2627
#include "Print.h"
2728

@@ -187,11 +188,16 @@ size_t Print::println(const Printable& x)
187188
return n;
188189
}
189190

191+
extern "C" void streamOutput(char character, void* arg)
192+
{
193+
(static_cast<Print *>(arg))->write(character);
194+
}
195+
190196
int Print::printf(const char* format, ...)
191197
{
192198
va_list va;
193199
va_start(va, format);
194-
int ret = vprintf(format, va);
200+
int ret = vfctprintf(&streamOutput, this, format, va);
195201
va_end(va);
196202
return ret;
197203
}

0 commit comments

Comments
 (0)