arduino / ArduinoCore-renesas

MIT License
113 stars 79 forks source link

Serial.printf support #351

Closed kakopappa closed 4 months ago

kakopappa commented 4 months ago

I noticed Serial does not support Serial.printf. This is what I have done so far. could be wrong Please correct me if I am wrong here.

in Print.h

size_t printf(const char *format, ...);

in Print.cpp

#include <stdarg.h> // Required for va_list, va_start, va_end
.....

size_t Print::printf(const char *format, ...) {
  va_list arg;
  va_start(arg, format);
  size_t ret = vprintf(format, arg);
  va_end(arg);
  return ret;
}
per1234 commented 4 months ago

Closing as off topic since the Print class is not implemented in this repository, but instead in https://github.com/arduino/ArduinoCore-API.

We already have a request in that repository: https://github.com/arduino/ArduinoCore-API/issues/32