Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | // -*- Mode: C++; c-basic-offset: 8; indent-tabs-mode: nil -*- |
2 | // |
||
3 | // Copyright (c) 2010 Michael Smith. All rights reserved. |
||
4 | // |
||
5 | // This is free software; you can redistribute it and/or modify it under |
||
6 | // the terms of the GNU Lesser General Public License as published by the |
||
7 | // Free Software Foundation; either version 2.1 of the License, or (at |
||
8 | // your option) any later version. |
||
9 | // |
||
10 | |||
11 | #ifndef __BETTERSTREAM_H |
||
12 | #define __BETTERSTREAM_H |
||
13 | |||
14 | #include <Stream.h> |
||
15 | #include <avr/pgmspace.h> |
||
16 | #include "../AP_Common/AP_Common.h" |
||
17 | |||
18 | class BetterStream : public Stream { |
||
19 | public: |
||
20 | BetterStream(void) { |
||
21 | } |
||
22 | |||
23 | // Stream extensions |
||
24 | void print_P(const prog_char_t *); |
||
25 | void println_P(const prog_char_t *); |
||
26 | void printf(const char *, ...) |
||
27 | __attribute__ ((format(__printf__, 2, 3))); |
||
28 | void _printf_P(const prog_char *, ...); |
||
29 | __attribute__ ((format(__printf__, 2, 3))); |
||
30 | |||
31 | virtual int txspace(void); |
||
32 | |||
33 | #define printf_P(fmt, ...) _printf_P((const prog_char *)fmt, ## __VA_ARGS__) |
||
34 | |||
35 | private: |
||
36 | void _vprintf(unsigned char, const char *, va_list) |
||
37 | __attribute__ ((format(__printf__, 3, 0))); |
||
38 | }; |
||
39 | |||
40 | #endif // __BETTERSTREAM_H |
||
41 |