diff --git a/configs/dk-tm4c129x/src/dk-tm4c129x.h b/configs/dk-tm4c129x/src/dk-tm4c129x.h index ca6adf7383..543a1dbeac 100644 --- a/configs/dk-tm4c129x/src/dk-tm4c129x.h +++ b/configs/dk-tm4c129x/src/dk-tm4c129x.h @@ -72,11 +72,13 @@ * PQ4 Blue LED J36 pins 3 and 4 * 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_G (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTQ | GPIO_PIN_4) -#define GPIO_LED_B (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTQ | GPIO_PIN_7) +#define GPIO_LED_R (GPIO_FUNC_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTN | GPIO_PIN_5) +#define GPIO_LED_G (GPIO_FUNC_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTQ | GPIO_PIN_7) +#define GPIO_LED_B (GPIO_FUNC_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTQ | GPIO_PIN_4) /* Button definitions ***************************************************************/ /* There are three push buttons on the board. diff --git a/configs/dk-tm4c129x/src/tm4c_autoleds.c b/configs/dk-tm4c129x/src/tm4c_autoleds.c index 3faf883b25..cd344dbfba 100644 --- a/configs/dk-tm4c129x/src/tm4c_autoleds.c +++ b/configs/dk-tm4c129x/src/tm4c_autoleds.c @@ -86,6 +86,8 @@ void board_led_on(int led) * LED_ASSERTION 1 NC NC NC * LED_PANIC 3 ON OFF OFF (flashing 2Hz) * --------------- ------- ---- ----- -------------------- + * + * A high output illuminates the LED. */ switch (led) @@ -93,7 +95,7 @@ void board_led_on(int led) case 0: /* R=OFF, G=OFF, B=ON */ /* Previous state was all OFF */ - tiva_gpiowrite(GPIO_LED_B, false); + tiva_gpiowrite(GPIO_LED_B, true); break; default: @@ -103,16 +105,16 @@ void board_led_on(int led) case 2: /* R=OFF, G=ON, B=OFF */ /* Previous state was all: R=OFF, G=OFF, B=ON */ - tiva_gpiowrite(GPIO_LED_G, false); - tiva_gpiowrite(GPIO_LED_B, true); + tiva_gpiowrite(GPIO_LED_G, true); + tiva_gpiowrite(GPIO_LED_B, false); break; case 3: /* R=ON, G=OFF, B=OFF */ /* Previous state was all: R=OFF, G=Unknown, B=Unknown */ - tiva_gpiowrite(GPIO_LED_R, false); - tiva_gpiowrite(GPIO_LED_G, true); - tiva_gpiowrite(GPIO_LED_B, true); + tiva_gpiowrite(GPIO_LED_R, true); + tiva_gpiowrite(GPIO_LED_G, false); + tiva_gpiowrite(GPIO_LED_B, false); break; } } @@ -135,6 +137,8 @@ void board_led_off(int led) * LED_ASSERTION 1 NC NC NC * LED_PANIC 3 ON OFF OFF (flashing 2Hz) * --------------- ------- ---- ----- -------------------- + * + * A high output illuminates the LED. */ switch (led) @@ -148,7 +152,7 @@ void board_led_off(int led) case 3: /* R=OFF, 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); } } diff --git a/configs/dk-tm4c129x/src/tm4c_userleds.c b/configs/dk-tm4c129x/src/tm4c_userleds.c index 0ba77033af..087d7367db 100644 --- a/configs/dk-tm4c129x/src/tm4c_userleds.c +++ b/configs/dk-tm4c129x/src/tm4c_userleds.c @@ -41,6 +41,8 @@ * PQ4 Blue LED J36 pins 3 and 4 * 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; } - 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) { - bool ledoff; + bool ledon; - ledoff = ((ledset & BOARD_LED_R_BIT) == 0); - tiva_gpiowrite(GPIO_LED_R, ledoff); + ledon = ((ledset & BOARD_LED_R_BIT) != 0); + tiva_gpiowrite(GPIO_LED_R, ledon); - ledoff = ((ledset & BOARD_LED_G_BIT) == 0); - tiva_gpiowrite(GPIO_LED_G, ledoff); + ledon = ((ledset & BOARD_LED_G_BIT) != 0); + tiva_gpiowrite(GPIO_LED_G, ledon); - ledoff = ((ledset & BOARD_LED_B_BIT) == 0); - tiva_gpiowrite(GPIO_LED_B, ledoff); + ledon = ((ledset & BOARD_LED_B_BIT) != 0); + tiva_gpiowrite(GPIO_LED_B, ledon); } #endif /* !CONFIG_ARCH_LEDS */