Skip to content
Snippets Groups Projects
Commit 8aa8f81b authored by Andrew Tridgell's avatar Andrew Tridgell
Browse files

FastSerial: added a vprintf_P() function

used by CLI on UART2
parent aeb39dab
No related branches found
No related tags found
No related merge requests found
...@@ -44,15 +44,21 @@ BetterStream::printf(const char *fmt, ...) ...@@ -44,15 +44,21 @@ BetterStream::printf(const char *fmt, ...)
} }
void void
BetterStream::_printf_P(const prog_char *fmt, ...) BetterStream::_printf_P(const prog_char_t *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
_vprintf(1, fmt, ap); _vprintf(1, (const char *)fmt, ap);
va_end(ap); va_end(ap);
} }
void
BetterStream::vprintf_P(const prog_char_t *fmt, va_list ap)
{
_vprintf(1, (const char *)fmt, ap);
}
int int
BetterStream::txspace(void) BetterStream::txspace(void)
{ {
......
...@@ -25,12 +25,13 @@ public: ...@@ -25,12 +25,13 @@ public:
void println_P(const prog_char_t *); void println_P(const prog_char_t *);
void printf(const char *, ...) void printf(const char *, ...)
__attribute__ ((format(__printf__, 2, 3))); __attribute__ ((format(__printf__, 2, 3)));
void _printf_P(const prog_char *, ...); void _printf_P(const prog_char_t *, ...);
__attribute__ ((format(__printf__, 2, 3))); __attribute__ ((format(__printf__, 2, 3)));
void vprintf_P(const prog_char_t *, va_list);
virtual int txspace(void); virtual int txspace(void);
#define printf_P(fmt, ...) _printf_P((const prog_char *)fmt, ## __VA_ARGS__) #define printf_P(fmt, ...) _printf_P((const prog_char_t *)fmt, ## __VA_ARGS__)
private: private:
void _vprintf(unsigned char, const char *, va_list) void _vprintf(unsigned char, const char *, va_list)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment