From c0b7112dd9559c8d6062ec609af6c07d5175d8cd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 6 May 2013 11:07:53 -0600 Subject: [PATCH] Fixes LEDs on the Freedom KL25Z board --- configs/freedom-kl25z/README.txt | 18 +++++----- configs/freedom-kl25z/src/freedom-kl25z.h | 6 ++-- configs/freedom-kl25z/src/kl_led.c | 42 ++++++++++++++++------- 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/configs/freedom-kl25z/README.txt b/configs/freedom-kl25z/README.txt index 00bb4640bc..5a278d3fa4 100644 --- a/configs/freedom-kl25z/README.txt +++ b/configs/freedom-kl25z/README.txt @@ -88,15 +88,15 @@ LEDs SYMBOL Meaning LED state Initially all LED is OFF ------------------- ----------------------- -------------------------- - LED_STARTED NuttX has been started - LED_HEAPALLOCATE Heap has been allocated - LED_IRQSENABLED Interrupts enabled - LED_STACKCREATED Idle stack created - LED_INIRQ In an interrupt - LED_SIGNAL In a signal handler - LED_ASSERTION An assertion failed - LED_PANIC The system has crashed - LED_IDLE K25Z1XX is in sleep mode (Optional, not used) + LED_STARTED NuttX has been started R=OFF G=OFF B=OFF + LED_HEAPALLOCATE Heap has been allocated (no change) + LED_IRQSENABLED Interrupts enabled (no change) + LED_STACKCREATED Idle stack created R=OFF G=OFF B=ON + LED_INIRQ In an interrupt (no change) + LED_SIGNAL In a signal handler (no change) + LED_ASSERTION An assertion failed (no change) + LED_PANIC The system has crashed R=FLASHING G=OFF B=OFF + LED_IDLE K25Z1XX is in sleep mode (Optional, not used) Serial Console ============== diff --git a/configs/freedom-kl25z/src/freedom-kl25z.h b/configs/freedom-kl25z/src/freedom-kl25z.h index cc2f35a84c..7638c45584 100644 --- a/configs/freedom-kl25z/src/freedom-kl25z.h +++ b/configs/freedom-kl25z/src/freedom-kl25z.h @@ -79,9 +79,9 @@ * LED_IDLE K25Z1XX is in sleep mode (Optional, not used) */ -#define GPIO_LED_R (GPIO_OUTPUT | PIN_PORTB | PIN18) -#define GPIO_LED_G (GPIO_OUTPUT | PIN_PORTB | PIN19) -#define GPIO_LED_B (GPIO_OUTPUT | PIN_PORTD | PIN1) +#define GPIO_LED_R (GPIO_OUTPUT | GPIO_OUTPUT_ONE | PIN_PORTB | PIN18) +#define GPIO_LED_G (GPIO_OUTPUT | GPIO_OUTPUT_ONE | PIN_PORTB | PIN19) +#define GPIO_LED_B (GPIO_OUTPUT | GPIO_OUTPUT_ONE | PIN_PORTD | PIN1) /* Button definitions ***************************************************************/ /* The Freedom KL25Z has no buttons */ diff --git a/configs/freedom-kl25z/src/kl_led.c b/configs/freedom-kl25z/src/kl_led.c index a71c566382..1d54be45cd 100644 --- a/configs/freedom-kl25z/src/kl_led.c +++ b/configs/freedom-kl25z/src/kl_led.c @@ -1,6 +1,6 @@ /**************************************************************************** - * configs/freedom-kl25z/src/up_autoleds.c - * arch/arm/src/board/up_autoleds.c + * configs/freedom-kl25z/src/kl_led.c + * arch/arm/src/board/kl_led.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -48,15 +48,15 @@ * SYMBOL Meaning LED state * Initially all LED is OFF * ------------------- ----------------------- -------------------------- - * LED_STARTED NuttX has been started - * LED_HEAPALLOCATE Heap has been allocated - * LED_IRQSENABLED Interrupts enabled - * LED_STACKCREATED Idle stack created - * LED_INIRQ In an interrupt - * LED_SIGNAL In a signal handler - * LED_ASSERTION An assertion failed - * LED_PANIC The system has crashed - * LED_IDLE K25Z1XX is in sleep mode (Optional, not used) + * LED_STARTED NuttX has been started R=OFF G=OFF B=OFF + * LED_HEAPALLOCATE Heap has been allocated (no change) + * LED_IRQSENABLED Interrupts enabled (no change) + * LED_STACKCREATED Idle stack created R=OFF G=OFF B=ON + * LED_INIRQ In an interrupt (no change) + * LED_SIGNAL In a signal handler (no change) + * LED_ASSERTION An assertion failed (no change) + * LED_PANIC The system has crashed R=FLASHING G=OFF B=OFF + * LED_IDLE K25Z1XX is in sleep mode (Optional, not used) */ /**************************************************************************** @@ -138,7 +138,18 @@ void kl_ledinit(void) void up_ledon(int led) { - kl_gpiowrite(GPIO_LED_B, false); + if (led == LED_STACKCREATED) + { + kl_gpiowrite(GPIO_LED_R, true); + kl_gpiowrite(GPIO_LED_G, true); + kl_gpiowrite(GPIO_LED_B, false); + } + else if (led == LED_PANIC) + { + kl_gpiowrite(GPIO_LED_R, false); + kl_gpiowrite(GPIO_LED_G, true); + kl_gpiowrite(GPIO_LED_B, true); + } } /**************************************************************************** @@ -147,7 +158,12 @@ void up_ledon(int led) void up_ledoff(int led) { - kl_gpiowrite(GPIO_LED_B, true); + if (led == LED_PANIC) + { + kl_gpiowrite(GPIO_LED_R, true); + kl_gpiowrite(GPIO_LED_G, true); + kl_gpiowrite(GPIO_LED_B, true); + } } #endif /* CONFIG_ARCH_LEDS */