aboutsummaryrefslogtreecommitdiff
path: root/Debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'Debug.h')
-rw-r--r--Debug.h31
1 files changed, 6 insertions, 25 deletions
diff --git a/Debug.h b/Debug.h
index 4883083..9bf82bf 100644
--- a/Debug.h
+++ b/Debug.h
@@ -3,15 +3,9 @@
#include "config-check.h"
-template<bool B, class T, class F>
-struct conditional { typedef T type; };
+#include <AltSoftSerial.h>
-template<class T, class F>
-struct conditional<false, T, F> { typedef F type; };
-
-#include <SoftwareSerial.h>
-
-#ifdef __AVR_ATtiny85__
+#ifdef ARDUINO_attiny
class Serial {
public:
void begin(int);
@@ -33,27 +27,14 @@ enum DebugSink {
DEBUG_SINK_SOFTWARE_SERIAL,
};
-struct DebugEmptyBase {};
-struct DebugSoftwareSerialBase {
- // TODO: these should be customizable
- static const int rx_pin = 1;
- static const int tx_pin = 0;
-
-public:
- SoftwareSerial ss;
-
- DebugSoftwareSerialBase() : ss(rx_pin, tx_pin) {
- }
-};
-
-template <enum DebugSink sink_>
-class Debug : public conditional<sink_ == DEBUG_SINK_SOFTWARE_SERIAL, DebugSoftwareSerialBase, DebugEmptyBase>::type
+template <enum DebugSink sink_, int rx_pin = 1, int tx_pin = 0>
+class Debug
{
-
+ AltSoftSerial ss;
public:
const enum DebugSink sink;
- Debug() : sink(sink_) {
+ Debug() : ss(rx_pin, tx_pin), sink(sink_) {
}
inline void begin(const long baud_rate) {