Permalink
Browse files

fixed tags for arduino/c++ article

  • Loading branch information...
Bernard `Guyzmo` Pratz
Bernard `Guyzmo` Pratz committed Sep 4, 2016
1 parent e0b764a commit cb6e3b9353c11547a558ab7e7304a387a4200db5
Showing with 10 additions and 10 deletions.
  1. +10 −10 content/code/on/Arduino_C++_Style.markdown
@@ -1,7 +1,7 @@
---
type: post
categories: code
tags: [ hack, bootloader, avr ]
tags: [ c++, arduino, avr, code, syntax ]
title: "Arduino: C++ Style"
date: 2014-04-08T13:37:53+02:00
summary: "Here's a tip that will make C coders yell and cry, but will make C++ coders happy: how to implement C++ stream syntax for Arduino."
@@ -21,27 +21,27 @@ running on the microcontroller:

static uint8_t base=0;
inline Print &operator <<(Print &obj, unsigned long arg)
{
{
switch (base) {
case HEX: obj.print(F("0x")); break;
case BIN: obj.print(F("0b")); break;
}
obj.print(arg, (int)base);
base = 0;
return obj;
return obj;
}
template<class T>
inline Print &operator <<(Print &obj, T arg) {
obj.print(arg);
return obj;
inline Print &operator <<(Print &obj, T arg) {
obj.print(arg);
return obj;
}
inline unsigned long hex(unsigned long arg) {
inline unsigned long hex(unsigned long arg) {
base = HEX;
return arg;
return arg;
}
inline unsigned long bin(unsigned long arg) {
inline unsigned long bin(unsigned long arg) {
base = BIN;
return arg;
return arg;
}

#define endl F("\n")

0 comments on commit cb6e3b9

Please sign in to comment.