+++ /dev/null
-/*\r
-Streaming.h - Arduino library for supporting the << streaming operator\r
-Copyright (c) 2010 Mikal Hart. All rights reserved.\r
-\r
-This library is free software; you can redistribute it and/or\r
-modify it under the terms of the GNU Lesser General Public\r
-License as published by the Free Software Foundation; either\r
-version 2.1 of the License, or (at your option) any later version.\r
-\r
-This library is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
-Lesser General Public License for more details.\r
-\r
-You should have received a copy of the GNU Lesser General Public\r
-License along with this library; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
-*/\r
-\r
-#ifndef ARDUINO_STREAMING\r
-#define ARDUINO_STREAMING\r
-\r
-//#include <WProgram.h>\r
-\r
-#define STREAMING_LIBRARY_VERSION 4\r
-\r
-// Generic template\r
-template<class T> \r
-inline Print &operator <<(Print &stream, T arg) \r
-{ stream.print(arg); return stream; }\r
-\r
-struct _BASED \r
-{ \r
- long val; \r
- int base;\r
- _BASED(long v, int b): val(v), base(b) \r
- {}\r
-};\r
-\r
-#define _HEX(a) _BASED(a, HEX)\r
-#define _DEC(a) _BASED(a, DEC)\r
-#define _OCT(a) _BASED(a, OCT)\r
-#define _BIN(a) _BASED(a, BIN)\r
-#define _BYTE(a) _BASED(a, BYTE)\r
-\r
-// Specialization for class _BASED\r
-// Thanks to Arduino forum user Ben Combee who suggested this \r
-// clever technique to allow for expressions like\r
-// Serial << _HEX(a);\r
-\r
-inline Print &operator <<(Print &obj, const _BASED &arg)\r
-{ obj.print(arg.val, arg.base); return obj; } \r
-\r
-#if ARDUINO >= 18\r
-// Specialization for class _FLOAT\r
-// Thanks to Michael Margolis for suggesting a way\r
-// to accommodate Arduino 0018's floating point precision\r
-// feature like this:\r
-// Serial << _FLOAT(gps_latitude, 6); // 6 digits of precision\r
-\r
-struct _FLOAT\r
-{\r
- float val;\r
- int digits;\r
- _FLOAT(double v, int d): val(v), digits(d)\r
- {}\r
-};\r
-\r
-inline Print &operator <<(Print &obj, const _FLOAT &arg)\r
-{ obj.print(arg.val, arg.digits); return obj; }\r
-#endif\r
-\r
-// Specialization for enum _EndLineCode\r
-// Thanks to Arduino forum user Paul V. who suggested this\r
-// clever technique to allow for expressions like\r
-// Serial << "Hello!" << endl;\r
-\r
-enum _EndLineCode { endl };\r
-\r
-inline Print &operator <<(Print &obj, _EndLineCode arg) \r
-{ obj.println(); return obj; }\r
-\r
-#endif\r
-\r