mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-08 17:02:26 +03:00
add Print::printf
This commit is contained in:
@ -30,6 +30,7 @@
|
||||
#include "Print.h"
|
||||
extern "C" {
|
||||
#include "c_types.h"
|
||||
#include "ets_sys.h"
|
||||
}
|
||||
|
||||
// Public Methods //////////////////////////////////////////////////////////////
|
||||
@ -43,6 +44,16 @@ size_t ICACHE_FLASH_ATTR Print::write(const uint8_t *buffer, size_t size) {
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t Print::printf(const char *format, ...) {
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
char temp[256];
|
||||
size_t len = ets_vsnprintf(temp, 256, format, arg);
|
||||
len = write((const char *)temp);
|
||||
va_end(arg);
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t ICACHE_FLASH_ATTR Print::print(const __FlashStringHelper *ifsh) {
|
||||
PGM_P p = reinterpret_cast<PGM_P>(ifsh);
|
||||
|
||||
|
Reference in New Issue
Block a user