diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-07-31 20:34:29 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-07-31 20:34:29 +0200 |
commit | 930b9e23ab981251e0cbd839c5a2f3a769c3fb47 (patch) | |
tree | 010f8a93acf9ab8d4694a5a567fe53de3f3dfb38 /Debug.h | |
parent | 9b086f8c4b5e96b46a3904c3bcfe11af39347b80 (diff) | |
download | trygvisio_soil_moisture-930b9e23ab981251e0cbd839c5a2f3a769c3fb47.tar.gz trygvisio_soil_moisture-930b9e23ab981251e0cbd839c5a2f3a769c3fb47.tar.bz2 trygvisio_soil_moisture-930b9e23ab981251e0cbd839c5a2f3a769c3fb47.tar.xz trygvisio_soil_moisture-930b9e23ab981251e0cbd839c5a2f3a769c3fb47.zip |
o Even better Debug for the ATtiny85 implementation.h.
Diffstat (limited to 'Debug.h')
-rw-r--r-- | Debug.h | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -3,6 +3,22 @@ #include "config-check.h" +#ifdef __AVR_ATtiny85__ +class Serial { +public: + void begin(int); + void write(uint8_t); + int read(); + void print(...); + void println(...); + operator bool(); + bool available(); + void flush(); +}; + +extern Serial Serial; +#endif + enum DebugSink { DEBUG_SINK_SERIAL, DEBUG_SINK_SOFTWARE_SERIAL, @@ -30,6 +46,14 @@ public: return false; }; + inline int read() const { + if (sink == DEBUG_SINK_SERIAL) { + return Serial.read(); + } + + return '\0'; + }; + size_t write(uint8_t value) const { if (sink == DEBUG_SINK_SERIAL) { Serial.write(value); |