DK-TM4C129X: Fix sense of LEDs; active high. Also GPIO for blue and green reversed

This commit is contained in:
Gregory Nutt 2014-12-22 17:41:04 -06:00
parent b9d0094124
commit a322029dbe
3 changed files with 26 additions and 18 deletions

View File

@ -72,11 +72,13 @@
* PQ4 Blue LED J36 pins 3 and 4 * PQ4 Blue LED J36 pins 3 and 4
* PQ7 Green LED J36 pins 5 and 6 * PQ7 Green LED J36 pins 5 and 6
* --- ------------ ----------------- * --- ------------ -----------------
*
* A high output illuminates the LED.
*/ */
#define GPIO_LED_R (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTN | GPIO_PIN_5) #define GPIO_LED_R (GPIO_FUNC_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTN | GPIO_PIN_5)
#define GPIO_LED_G (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTQ | GPIO_PIN_4) #define GPIO_LED_G (GPIO_FUNC_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTQ | GPIO_PIN_7)
#define GPIO_LED_B (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTQ | GPIO_PIN_7) #define GPIO_LED_B (GPIO_FUNC_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTQ | GPIO_PIN_4)
/* Button definitions ***************************************************************/ /* Button definitions ***************************************************************/
/* There are three push buttons on the board. /* There are three push buttons on the board.

View File

@ -86,6 +86,8 @@ void board_led_on(int led)
* LED_ASSERTION 1 NC NC NC * LED_ASSERTION 1 NC NC NC
* LED_PANIC 3 ON OFF OFF (flashing 2Hz) * LED_PANIC 3 ON OFF OFF (flashing 2Hz)
* --------------- ------- ---- ----- -------------------- * --------------- ------- ---- ----- --------------------
*
* A high output illuminates the LED.
*/ */
switch (led) switch (led)
@ -93,7 +95,7 @@ void board_led_on(int led)
case 0: /* R=OFF, G=OFF, B=ON */ case 0: /* R=OFF, G=OFF, B=ON */
/* Previous state was all OFF */ /* Previous state was all OFF */
tiva_gpiowrite(GPIO_LED_B, false); tiva_gpiowrite(GPIO_LED_B, true);
break; break;
default: default:
@ -103,16 +105,16 @@ void board_led_on(int led)
case 2: /* R=OFF, G=ON, B=OFF */ case 2: /* R=OFF, G=ON, B=OFF */
/* Previous state was all: R=OFF, G=OFF, B=ON */ /* Previous state was all: R=OFF, G=OFF, B=ON */
tiva_gpiowrite(GPIO_LED_G, false); tiva_gpiowrite(GPIO_LED_G, true);
tiva_gpiowrite(GPIO_LED_B, true); tiva_gpiowrite(GPIO_LED_B, false);
break; break;
case 3: /* R=ON, G=OFF, B=OFF */ case 3: /* R=ON, G=OFF, B=OFF */
/* Previous state was all: R=OFF, G=Unknown, B=Unknown */ /* Previous state was all: R=OFF, G=Unknown, B=Unknown */
tiva_gpiowrite(GPIO_LED_R, false); tiva_gpiowrite(GPIO_LED_R, true);
tiva_gpiowrite(GPIO_LED_G, true); tiva_gpiowrite(GPIO_LED_G, false);
tiva_gpiowrite(GPIO_LED_B, true); tiva_gpiowrite(GPIO_LED_B, false);
break; break;
} }
} }
@ -135,6 +137,8 @@ void board_led_off(int led)
* LED_ASSERTION 1 NC NC NC * LED_ASSERTION 1 NC NC NC
* LED_PANIC 3 ON OFF OFF (flashing 2Hz) * LED_PANIC 3 ON OFF OFF (flashing 2Hz)
* --------------- ------- ---- ----- -------------------- * --------------- ------- ---- ----- --------------------
*
* A high output illuminates the LED.
*/ */
switch (led) switch (led)
@ -148,7 +152,7 @@ void board_led_off(int led)
case 3: /* R=OFF, G=OFF, B=OFF */ case 3: /* R=OFF, G=OFF, B=OFF */
/* Previous state was all: R=ON, G=OFF, B=OFF */ /* Previous state was all: R=ON, G=OFF, B=OFF */
tiva_gpiowrite(GPIO_LED_R, true); tiva_gpiowrite(GPIO_LED_R, false);
} }
} }

View File

@ -41,6 +41,8 @@
* PQ4 Blue LED J36 pins 3 and 4 * PQ4 Blue LED J36 pins 3 and 4
* PQ7 Green LED J36 pins 5 and 6 * PQ7 Green LED J36 pins 5 and 6
* --- ------------ ----------------- * --- ------------ -----------------
*
* A high output illuminates the LED.
*/ */
/**************************************************************************** /****************************************************************************
@ -118,7 +120,7 @@ void tiva_setled(int led, bool ledon)
return; return;
} }
tiva_gpiowrite(ledcfg, !ledon); tiva_gpiowrite(ledcfg, ledon);
} }
/**************************************************************************** /****************************************************************************
@ -127,16 +129,16 @@ void tiva_setled(int led, bool ledon)
void tiva_setleds(uint8_t ledset) void tiva_setleds(uint8_t ledset)
{ {
bool ledoff; bool ledon;
ledoff = ((ledset & BOARD_LED_R_BIT) == 0); ledon = ((ledset & BOARD_LED_R_BIT) != 0);
tiva_gpiowrite(GPIO_LED_R, ledoff); tiva_gpiowrite(GPIO_LED_R, ledon);
ledoff = ((ledset & BOARD_LED_G_BIT) == 0); ledon = ((ledset & BOARD_LED_G_BIT) != 0);
tiva_gpiowrite(GPIO_LED_G, ledoff); tiva_gpiowrite(GPIO_LED_G, ledon);
ledoff = ((ledset & BOARD_LED_B_BIT) == 0); ledon = ((ledset & BOARD_LED_B_BIT) != 0);
tiva_gpiowrite(GPIO_LED_B, ledoff); tiva_gpiowrite(GPIO_LED_B, ledon);
} }
#endif /* !CONFIG_ARCH_LEDS */ #endif /* !CONFIG_ARCH_LEDS */