Add LED logic

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3027 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2010-10-17 00:42:01 +00:00
parent 865df586b3
commit 0c509cc8fc
3 changed files with 38 additions and 11 deletions

View File

@ -74,15 +74,18 @@
#define PINMUX_USART1_TXD PINMUX_USART1_TXD_1
/* LED definitions ******************************************************************/
/* The AVR32DEV1 board has 3 LEDs, two of which can be controlled through GPIO pins */
#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
/* 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

View File

@ -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

View File

@ -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 */