diff --git a/cores/nRF5/Print.cpp b/cores/nRF5/Print.cpp index 2cce751..f8a3863 100644 --- a/cores/nRF5/Print.cpp +++ b/cores/nRF5/Print.cpp @@ -22,9 +22,15 @@ #include #include #include "Arduino.h" +#include "libc/printf/printf.h" #include "Print.h" +extern "C" void streamOutput(char c, void* arg) +{ + (static_cast(arg))->write(c); +} + // Public Methods ////////////////////////////////////////////////////////////// /* default implementation: may be overridden */ @@ -191,7 +197,7 @@ int Print::printf(const char* format, ...) { va_list va; va_start(va, format); - int ret = vprintf(format, va); + int ret = vfctprintf(&streamOutput, this, format, va); va_end(va); return ret; }