diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-10-17 00:42:01 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-10-17 00:42:01 +0000 |
commit | d25a6f0ea1d2c6e3da3be0e32bea00300a329c33 (patch) | |
tree | 3dd9be5f681e0f2c50d3d752978b475fc70ae834 /nuttx/configs/avr32dev1 | |
parent | bf07771326512a3ae595e97e30166df63a327ff3 (diff) | |
download | px4-nuttx-d25a6f0ea1d2c6e3da3be0e32bea00300a329c33.tar.gz px4-nuttx-d25a6f0ea1d2c6e3da3be0e32bea00300a329c33.tar.bz2 px4-nuttx-d25a6f0ea1d2c6e3da3be0e32bea00300a329c33.zip |
Add LED logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3027 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/avr32dev1')
-rwxr-xr-x | nuttx/configs/avr32dev1/include/board.h | 21 | ||||
-rwxr-xr-x | nuttx/configs/avr32dev1/src/avr32dev1_internal.h | 21 | ||||
-rwxr-xr-x | nuttx/configs/avr32dev1/src/up_leds.c | 9 |
3 files changed, 39 insertions, 12 deletions
diff --git a/nuttx/configs/avr32dev1/include/board.h b/nuttx/configs/avr32dev1/include/board.h index 7931e3525..2ef9532f0 100755 --- a/nuttx/configs/avr32dev1/include/board.h +++ b/nuttx/configs/avr32dev1/include/board.h @@ -74,15 +74,18 @@ #define PINMUX_USART1_TXD PINMUX_USART1_TXD_1 /* LED definitions ******************************************************************/ - -#define LED_STARTED 0 -#define LED_HEAPALLOCATE 1 -#define LED_IRQSENABLED 2 -#define LED_STACKCREATED 3 -#define LED_INIRQ 4 -#define LED_SIGNAL 5 -#define LED_ASSERTION 6 -#define LED_PANIC 7 +/* The AVR32DEV1 board has 3 LEDs, two of which can be controlled through GPIO pins */ + + /* ON OFF */ + /* LED1 LED2 LED1 LED2 */ +#define LED_STARTED 0 /* OFF OFF OFF OFF */ +#define LED_HEAPALLOCATE 0 /* OFF OFF OFF OFF */ +#define LED_IRQSENABLED 0 /* OFF OFF OFF OFF */ +#define LED_STACKCREATED 1 /* ON OFF OFF OFF */ +#define LED_INIRQ 2 /* ON ON ON OFF */ +#define LED_SIGNAL 2 /* ON ON ON OFF */ +#define LED_ASSERTION 2 /* ON ON ON OFF */ +#define LED_PANIC 2 /* ON ON ON OFF */ /************************************************************************************ * Public Types diff --git a/nuttx/configs/avr32dev1/src/avr32dev1_internal.h b/nuttx/configs/avr32dev1/src/avr32dev1_internal.h index 0388c01b8..9a673ae0c 100755 --- a/nuttx/configs/avr32dev1/src/avr32dev1_internal.h +++ b/nuttx/configs/avr32dev1/src/avr32dev1_internal.h @@ -49,6 +49,27 @@ ************************************************************************************/
/* AVRDEV1 GPIO Pin Definitions *****************************************************/
+/* LEDs
+ *
+ * The AVR32DEV1 board has 3 LEDs, two of which can be controlled through GPIO pins.
+ *
+ * PIN 13 PA7 LED1
+ * PIN 14 PA8 LED2
+ */
+
+#define PINMUX_GPIO_LED1 (GPIO_ENABLE | GPIO_OUTPUT | GPIO_LOW | GPIO_PORTA | 7)
+#define PINMUX_GPIO_LED2 (GPIO_ENABLE | GPIO_OUTPUT | GPIO_LOW | GPIO_PORTA | 8)
+
+/* KEYs
+ *
+ * The AVR32DEV1 board has 3 KEYs, two of which can be sensed through GPIO pins.
+ *
+ * PIN 24 PB2 KEY1
+ * PIN 25 PB3 KEY2
+ */
+
+#define PINMUX_GPIO_KEY1 (GPIO_ENABLE | GPIO_INPUT | GPIO_PORTB | 2)
+#define PINMUX_GPIO_KEY2 (GPIO_ENABLE | GPIO_INPUT | GPIO_PORTB | 3)
/************************************************************************************
* Public Types
diff --git a/nuttx/configs/avr32dev1/src/up_leds.c b/nuttx/configs/avr32dev1/src/up_leds.c index 5118ccde6..ba29aeeb6 100755 --- a/nuttx/configs/avr32dev1/src/up_leds.c +++ b/nuttx/configs/avr32dev1/src/up_leds.c @@ -105,7 +105,8 @@ void up_ledinitialize(void) { -# warning "Not implemented" + at91uc3_configgpio(PINMUX_GPIO_LED1); + at91uc3_configgpio(PINMUX_GPIO_LED2); } /**************************************************************************** @@ -114,7 +115,8 @@ void up_ledinitialize(void) void up_ledon(int led) { -# warning "Not implemented" + at91uc3_gpiowrite(PINMUX_GPIO_LED1, (led != 0)); + at91uc3_gpiowrite(PINMUX_GPIO_LED2, (led == 2)); } /**************************************************************************** @@ -123,6 +125,7 @@ void up_ledon(int led) void up_ledoff(int led) { -# warning "Not implemented" + at91uc3_gpiowrite(PINMUX_GPIO_LED1, (led == 2)); + at91uc3_gpiowrite(PINMUX_GPIO_LED2, false); } #endif /* CONFIG_ARCH_LEDS */ |