]> oss.titaniummirror.com Git - rgblamp.git/blobdiff - tmr.h
Better cross-platform handling of time calcs
[rgblamp.git] / tmr.h
diff --git a/tmr.h b/tmr.h
index a204ab000675ed0f362c26465e95c3cc010c0d21..e985e1cfc0aff31be6d4e57510d4c452e3f4d37d 100644 (file)
--- a/tmr.h
+++ b/tmr.h
@@ -98,8 +98,8 @@ void tmr_isr();
 /* Wait for c clocks, 0 <= c < 128. */
 #define tmr_cwait(c) \
   do { \
-    unsigned t0 = TMR0; \
-    while (TMR0 - t0 <= c); \
+    unsigned char t0 = TMR0; \
+    while ((unsigned char)(TMR0 - t0) <= c); \
   } while (0)
 
 /* Wait for a number of us.  This is pretty accurate. */