summaryrefslogtreecommitdiff
path: root/nuttx/configs
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-12-22 17:41:04 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-12-22 17:41:04 -0600
commitcab5a2ce140c24d6504fb24fd3b0a682997723e1 (patch)
tree615162a49c7d66a88ecc3695f44b5bb01bed4e68 /nuttx/configs
parent6005fa85f9d6c23f607f2a84d80c33d646f0d6f8 (diff)
downloadnuttx-cab5a2ce140c24d6504fb24fd3b0a682997723e1.tar.gz
nuttx-cab5a2ce140c24d6504fb24fd3b0a682997723e1.tar.bz2
nuttx-cab5a2ce140c24d6504fb24fd3b0a682997723e1.zip
DK-TM4C129X: Fix sense of LEDs; active high. Also GPIO for blue and green reversed
Diffstat (limited to 'nuttx/configs')
-rw-r--r--nuttx/configs/dk-tm4c129x/src/dk-tm4c129x.h8
-rw-r--r--nuttx/configs/dk-tm4c129x/src/tm4c_autoleds.c18
-rw-r--r--nuttx/configs/dk-tm4c129x/src/tm4c_userleds.c18
3 files changed, 26 insertions, 18 deletions
diff --git a/nuttx/configs/dk-tm4c129x/src/dk-tm4c129x.h b/nuttx/configs/dk-tm4c129x/src/dk-tm4c129x.h
index ca6adf738..543a1dbea 100644
--- a/nuttx/configs/dk-tm4c129x/src/dk-tm4c129x.h
+++ b/nuttx/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/nuttx/configs/dk-tm4c129x/src/tm4c_autoleds.c b/nuttx/configs/dk-tm4c129x/src/tm4c_autoleds.c
index 3faf883b2..cd344dbfb 100644
--- a/nuttx/configs/dk-tm4c129x/src/tm4c_autoleds.c
+++ b/nuttx/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/nuttx/configs/dk-tm4c129x/src/tm4c_userleds.c b/nuttx/configs/dk-tm4c129x/src/tm4c_userleds.c
index 0ba77033a..087d7367d 100644
--- a/nuttx/configs/dk-tm4c129x/src/tm4c_userleds.c
+++ b/nuttx/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 */