debug
authorTero Marttila <terom@paivola.fi>
Wed, 24 Sep 2014 22:40:48 +0300
changeset 3 24bc72470027
parent 2 3420bd6d2d10
child 4 959d4b9c3f0a
debug
include/debug.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/debug.h	Wed Sep 24 22:40:48 2014 +0300
@@ -0,0 +1,32 @@
+#ifndef QMSK_DEBUG_H
+#define QMSK_DEBUG_H
+
+#include <avr/io.h>
+
+#include "stdlib.h"
+
+#if !defined(DEBUG_DDR) || !defined(DEBUG_PIN) || !defined(DEBUG_PORT)
+#   error("#define DEBUG_{DDR_PIN_PORT} before #include")
+#endif
+
+static inline void debug_init (void)
+{
+    sbi(&DEBUG_DDR, DEBUG_PIN);
+}
+
+static inline void debug_set (void)
+{
+    sbi(&DEBUG_PORT, DEBUG_PIN);
+}
+
+static inline void debug_clear (void)
+{
+    cbi(&DEBUG_PORT, DEBUG_PIN);
+}
+
+static inline void debug_toggle (void)
+{
+    xbi(&DEBUG_PORT, DEBUG_PIN);
+}
+
+#endif