]> git.llucax.com Git - z.facultad/66.09/etherled.git/commitdiff
Arregla macros para que no hagan lío evaluando cosas más de una vez.
authorLeandro Lucarella <llucax@gmail.com>
Thu, 8 Dec 2005 20:25:04 +0000 (20:25 +0000)
committerLeandro Lucarella <llucax@gmail.com>
Thu, 8 Dec 2005 20:25:04 +0000 (20:25 +0000)
src/debug.h
src/leds.h

index 1feac0992f659ccb9485157c411feaf2556cb860..9d70530ca312d5010d7d62daf5698ac3f4f2a904 100644 (file)
     }               \
     while (0)
 
-#define printb(bh, bl) print(WORD(bh, bl))
+#define printb(bh, bl)  \
+    do                  \
+    {                   \
+        ledsb(bh, bl);  \
+        sleep(8);       \
+    }                   \
+    while (0)
 
 #else // NO DEBUG
 
index 26c2cb36b0a397039f215eac2789d3b4df11a0cb..ea8c0837135f176e7bb955cff7046876be007e8e 100644 (file)
@@ -13,12 +13,21 @@ static byte xdata leds0 _at_ 0x0080;
 static byte xdata leds1 _at_ 0x00c0;
 #endif
 
-#define leds(word)              \
-           do                          \
-    {                           \
-                   leds0 = ~LOW(word);     \
-                   leds1 = ~HIGH(word);    \
-               }                           \
+#define leds(word)          \
+    do                      \
+    {                       \
+        uint16 w = word;    \
+        leds0 = ~LOW(w);    \
+        leds1 = ~HIGH(w);   \
+    }                       \
+    while (0)
+
+#define ledsb(bh, bl)   \
+    do                  \
+    {                   \
+        leds0 = ~(bl);  \
+        leds1 = ~(bh);  \
+    }                   \
     while (0)
 
 #endif // _LEDS_H_