AP_HAL_Empty: betterstreams get vprintfs

This commit is contained in:
Pat Hickey 2012-12-19 14:02:08 -08:00 committed by Andrew Tridgell
parent 823efc4734
commit b2d69e6a8c
4 changed files with 21 additions and 6 deletions

View File

@ -32,20 +32,28 @@ void EmptyConsoleDriver::println_P(const prog_char_t *pstr) {
_d->println_P(pstr);
}
void EmptyConsoleDriver::printf(const char *pstr, ...) {
void EmptyConsoleDriver::printf(const char *fmt, ...) {
va_list ap;
va_start(ap, pstr);
_d->printf(pstr, ap);
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
}
void EmptyConsoleDriver::_printf_P(const prog_char *pstr, ...) {
void EmptyConsoleDriver::_printf_P(const prog_char *fmt, ...) {
va_list ap;
va_start(ap, pstr);
_d->printf_P(pstr, ap);
va_start(ap,fmt);
vprintf_P(fmt, ap);
va_end(ap);
}
void EmptyConsoleDriver::vprintf(const char *fmt, va_list ap) {
_d->vprintf(fmt, ap);
}
void EmptyConsoleDriver::vprintf_P(const prog_char *fmt, va_list ap) {
_d->vprintf_P(fmt, ap);
}
int16_t EmptyConsoleDriver::available() {
return _d->available();
}

View File

@ -17,6 +17,8 @@ public:
void println_P(const prog_char_t *pstr);
void printf(const char *pstr, ...);
void _printf_P(const prog_char *pstr, ...);
void vprintf(const char *pstr, va_list ap);
void vprintf_P(const prog_char *pstr, va_list ap);
int16_t available();
int16_t txspace();

View File

@ -18,6 +18,8 @@ void EmptyUARTDriver::print_P(const prog_char_t *pstr) {}
void EmptyUARTDriver::println_P(const prog_char_t *pstr) {}
void EmptyUARTDriver::printf(const char *pstr, ...) {}
void EmptyUARTDriver::_printf_P(const prog_char *pstr, ...) {}
void EmptyUARTDriver::vprintf(const char *pstr, va_list ap) {}
void EmptyUARTDriver::vprintf_P(const prog_char *pstr, va_list ap) {}
/* Empty implementations of Stream virtual methods */
int16_t EmptyUARTDriver::available() { return 0; }

View File

@ -22,6 +22,9 @@ public:
void printf(const char *pstr, ...);
void _printf_P(const prog_char *pstr, ...);
void vprintf(const char* fmt, va_list ap);
void vprintf_P(const prog_char* fmt, va_list ap);
/* Empty implementations of Stream virtual methods */
int16_t available();
int16_t txspace();