2010-10-23 02:59:40 -03:00
|
|
|
// -*- Mode: C++; c-basic-offset: 8; indent-tabs-mode: nil -*-
|
|
|
|
//
|
|
|
|
// Copyright (c) 2010 Michael Smith. All rights reserved.
|
|
|
|
//
|
|
|
|
// This is free software; you can redistribute it and/or modify it under
|
|
|
|
// the terms of the GNU Lesser General Public License as published by the
|
|
|
|
// Free Software Foundation; either version 2.1 of the License, or (at
|
|
|
|
// your option) any later version.
|
|
|
|
//
|
|
|
|
|
2010-11-01 04:42:51 -03:00
|
|
|
#ifndef __BETTERSTREAM_H
|
|
|
|
#define __BETTERSTREAM_H
|
|
|
|
|
2010-10-23 02:59:40 -03:00
|
|
|
#include <Stream.h>
|
|
|
|
#include <avr/pgmspace.h>
|
2011-03-21 04:25:48 -03:00
|
|
|
#include <AP_Common.h>
|
2010-10-23 02:59:40 -03:00
|
|
|
|
|
|
|
class BetterStream : public Stream {
|
|
|
|
public:
|
|
|
|
BetterStream(void) {
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stream extensions
|
2011-03-21 04:25:48 -03:00
|
|
|
void print_P(const prog_char_t *);
|
|
|
|
void println_P(const prog_char_t *);
|
2010-11-23 05:09:52 -04:00
|
|
|
void printf(const char *, ...)
|
|
|
|
__attribute__ ((format(__printf__, 2, 3)));
|
2011-03-21 04:25:48 -03:00
|
|
|
void _printf_P(const prog_char *, ...);
|
2010-11-23 05:09:52 -04:00
|
|
|
__attribute__ ((format(__printf__, 2, 3)));
|
2010-10-23 02:59:40 -03:00
|
|
|
|
2011-03-21 04:25:48 -03:00
|
|
|
#define printf_P(fmt, ...) _printf_P((const prog_char *)fmt, ## __VA_ARGS__)
|
|
|
|
|
2010-10-23 02:59:40 -03:00
|
|
|
private:
|
2010-11-23 05:09:52 -04:00
|
|
|
void _vprintf(unsigned char, const char *, va_list)
|
|
|
|
__attribute__ ((format(__printf__, 3, 0)));
|
2010-10-23 02:59:40 -03:00
|
|
|
};
|
2010-11-01 04:42:51 -03:00
|
|
|
|
|
|
|
#endif // __BETTERSTREAM_H
|
|
|
|
|