]> oss.titaniummirror.com Git - rgblamp.git/commitdiff
LED reassignments
authorR. Steve McKown <rsmckown@gmail.com>
Wed, 14 Dec 2011 06:26:15 +0000 (23:26 -0700)
committerR. Steve McKown <rsmckown@gmail.com>
Thu, 15 Dec 2011 05:49:12 +0000 (22:49 -0700)
Should make it easier to make a compact board.

main.c
rgb.c
rgb.h

diff --git a/main.c b/main.c
index 0726aafb2942763587a24b3e4a3c8e0f2d907156..cb05d747df629781ae1e3a1647440090f9e93ca9 100644 (file)
--- a/main.c
+++ b/main.c
@@ -16,7 +16,7 @@
  * - (10) RA6 - unused
  * - (11) RC0 - T1OSO
  * - (12) RC1 - T1OSI
- * - (13) RC2 - CCP1 PWM for red LED
+ * - (13) RC2 - CCP1 PWM for wht LED
  * - (14) RC3 - unused
  * - (15) RC4 - unused
  * - (16) RC5 - unused
  * - (18) RC7 - unused
  * - (19) Vss
  * - (20) Vdd
- * - (21) RB0 - CCP4 PWM for wht LED
+ * - (21) RB0 - CCP4 PWM for blu LED
  * - (22) RB1 - Pushbutton
  * - (23) RB2 - Rocker switch, right
  * - (24) RB3 - CCP2 PWM for grn LED
  * - (25) RB4 - Rocker switch, left
- * - (26) RB5 - CCP3 PWM for blu LED
+ * - (26) RB5 - CCP3 PWM for red LED
  * - (27) RB6 - ICSPCLK
  * - (28) RB7 - ICSPDAT
  */
diff --git a/rgb.c b/rgb.c
index 151182c1fc0b07911118950cd0d4c36f7cd83123..d2d6a805b629a054f73808a497054bf7480e0112 100644 (file)
--- a/rgb.c
+++ b/rgb.c
@@ -12,7 +12,7 @@
 void rgb_init()
 {
     /* Initialize rgb
-     * CCP1 on RC2, CCP2 on RB3, CCP3 on RB5, CCP4 on RB0
+     * red on CCP3/RB5, grn on CCP2/RB3, blu on CCP4/RB0, wht on CCP1/RC2
      * - Fosc =     8 MHz,    4 MHz,    2 MHz
      * - Prescale = 4,        1,        1
      * - PRx value = 0xff
@@ -27,7 +27,7 @@ void rgb_init()
 
     /* Configure CCP1 */
     CCP1CON = 0b00001100;
-    CCPR1L = 0; /* Initial red value; only using 8 LSBs */
+    CCPR1L = 0; /* Initial wht value; only using 8 LSBs */
 
     /* Configure CCP2 */
     CCP2SEL = 1; /* CCP2 is on RB3 */
@@ -35,13 +35,13 @@ void rgb_init()
     CCPR2L = 0; /* Initial grn value; only using 8 LSBs */
 
     /* Configure CCP3 */
-    CCP3SEL = 1; /* CCP2 is on RB5 */
+    CCP3SEL = 1; /* CCP3 is on RB5 */
     CCP3CON = 0b00001100;
-    CCPR3L = 0; /* Initial blu value; only using 8 LSBs */
+    CCPR3L = 0; /* Initial red value; only using 8 LSBs */
 
     /* Configure CCP4 */
     CCP4CON = 0b00001100;
-    CCPR4L = 0; /* Initial wht value; only using 8 LSBs */
+    CCPR4L = 0; /* Initial blu value; only using 8 LSBs */
 
     /* Configure Timer2.  Start it to set 0 outputs, then stop it. */
     CCPTMRS0 = 0; /* CCP[1-4] use Timer 2 */
diff --git a/rgb.h b/rgb.h
index 05a061c823c3922cfa72bab0139164afc0ab27b0..4456c8075bd500d6a855c42be3cddf033165a363 100644 (file)
--- a/rgb.h
+++ b/rgb.h
@@ -22,10 +22,10 @@ void rgb_off();
 /* Set a PWM value for each color LED.  0=off, 255=full on. */
 #define rgb_set(red, grn, blu, wht) do { \
     ndi(); /* FIXME: doesn't seem to fix flicker */ \
-    CCPR1L = (red); \
+    CCPR3L = (red); \
     CCPR2L = (grn); \
-    CCPR3L = (blu); \
-    CCPR4L = (wht); \
+    CCPR4L = (blu); \
+    CCPR1L = (wht); \
     nei(); \
 } while (0)