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/src | |
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/src')
-rwxr-xr-x | nuttx/configs/avr32dev1/src/avr32dev1_internal.h | 21 | ||||
-rwxr-xr-x | nuttx/configs/avr32dev1/src/up_leds.c | 9 |
2 files changed, 27 insertions, 3 deletions
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 */ |