Skip to content

Commit 865f415

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

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,9 +22,15 @@
2222
#include <string.h>
2323
#include <math.h>
2424
#include "Arduino.h"
25+
#include "libc/printf/printf.h"
2526

2627
#include "Print.h"
2728

29+
extern "C" void streamOutput(char c, void* arg)
30+
{
31+
(static_cast<Print *>(arg))->write(c);
32+
}
33+
2834
// Public Methods //////////////////////////////////////////////////////////////
2935

3036
/* default implementation: may be overridden */
@@ -191,7 +197,7 @@ 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)