]> oss.titaniummirror.com Git - rgblamp.git/blobdiff - main.c
Don't use the white LED in random mode
[rgblamp.git] / main.c
diff --git a/main.c b/main.c
index 4f36d146b1133f58aa7e32e07ddd4c05f9fc5831..232cc6a3a40a205063748e394332ac7db6999a0b 100644 (file)
--- a/main.c
+++ b/main.c
 #include <htc.h>
 #include <stdlib.h>
 #include "picinit.h"
+#include "unused.h"
 #include "buttons.h"
 #include "rgb.h"
-#include "unused.h"
+#include "timer.h"
 
-#define STEP_SIZE               32 /* ms */
 #define reset_steps()           do { incolor_steps = 1; fade_steps = 0; } \
                                   while (0)
 #define rand_u8()               (rand() & 0xff)
@@ -44,7 +44,7 @@
 #define leds_set(r,g,b,w)       rgb_set((r).value >> 7, \
                                   (g).value >> 7, \
                                   (b).value >> 7, \
-                                  (w).value >> 7)
+                                  0)
 
 typedef struct {
   int value;
@@ -90,6 +90,7 @@ int main(void)
     unused_init();
     buttons_init();
     rgb_init();
+    timer_init();
     dbgpin_init();
 
     reset_steps();
@@ -153,7 +154,7 @@ int main(void)
               wht.remainder = neww - (wht.value + wht.increment * fade_steps);
             }
             dbgpin_low();
-            __delay_ms(STEP_SIZE); /* step should be start to start... */
+            timer_owait(); /* wait 32 ms since last return from last call() */
             dbgpin_high();
         } else {
             rgb_off();