From: R. Steve McKown Date: Wed, 14 Dec 2011 06:26:15 +0000 (-0700) Subject: LED reassignments X-Git-Tag: 1.0~11 X-Git-Url: https://oss.titaniummirror.com/gitweb?p=rgblamp.git;a=commitdiff_plain;h=1eee76670bd725ca44d1574f96ff3a0d773f2995 LED reassignments Should make it easier to make a compact board. --- diff --git a/main.c b/main.c index 0726aaf..cb05d74 100644 --- 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 @@ -24,12 +24,12 @@ * - (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 151182c..d2d6a80 100644 --- 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 05a061c..4456c80 100644 --- 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)