mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 22:48:29 -04:00
43262a573f
Strip the stdio integration from FastSerial as we aren't using it and it just wastes space. Note that this does not attempt to fix the bogus floating point handling in ::print(ln). That's an issue for another day. BetterStream::printf(_P) aka FastSerial::printf(_P) support is now as documented for avr-libc printf with floating point support enabled. git-svn-id: https://arducopter.googlecode.com/svn/trunk@895 f9c3cf11-9bcb-44bc-f272-b75c42450872
55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
// -*- 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.
|
|
//
|
|
|
|
//
|
|
// Enhancements to the Arduino Stream class.
|
|
//
|
|
|
|
#include "BetterStream.h"
|
|
|
|
// Stream extensions////////////////////////////////////////////////////////////
|
|
|
|
void
|
|
BetterStream::print_P(const prog_char *s)
|
|
{
|
|
char c;
|
|
|
|
while ('\0' != (c = pgm_read_byte(s++)))
|
|
write(c);
|
|
}
|
|
|
|
void
|
|
BetterStream::println_P(const char *s)
|
|
{
|
|
print_P(s);
|
|
println();
|
|
}
|
|
|
|
void
|
|
BetterStream::printf(const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
_vprintf(0, fmt, ap);
|
|
va_end(ap);
|
|
}
|
|
|
|
void
|
|
BetterStream::printf_P(const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
_vprintf(1, fmt, ap);
|
|
va_end(ap);
|
|
}
|
|
|