From 57e57bba36ff3adbe9bcacf097a141ef5eaa2b0d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 27 Nov 2014 12:38:04 -0600 Subject: [PATCH] LPC4357 EVB: Ooops got sense of the LED GPIO backward --- configs/lpc4357-evb/README.txt | 2 +- configs/lpc4357-evb/include/board.h | 2 +- configs/lpc4357-evb/src/lpc4357-evb.h | 4 ++-- configs/lpc4357-evb/src/lpc43_autoleds.c | 28 +++++++++++++++--------- configs/lpc4357-evb/src/lpc43_userleds.c | 4 ++-- drivers/eeprom/README.txt | 4 ++-- 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/configs/lpc4357-evb/README.txt b/configs/lpc4357-evb/README.txt index 694343a447..12a166866c 100644 --- a/configs/lpc4357-evb/README.txt +++ b/configs/lpc4357-evb/README.txt @@ -555,7 +555,7 @@ LED and Pushbuttons LED SIGNAL MCU D6 LED_3V3 PE_& GPIO7[7] - LED is grounded and a high output illuminates the LED. + A low output illuminates the LED. If CONFIG_ARCH_LEDS is defined, the LED will be controlled as follows for NuttX debug functionality (where NC means "No Change"). diff --git a/configs/lpc4357-evb/include/board.h b/configs/lpc4357-evb/include/board.h index 5e23e4cb8a..e882a103e9 100644 --- a/configs/lpc4357-evb/include/board.h +++ b/configs/lpc4357-evb/include/board.h @@ -207,7 +207,7 @@ * D6 LED_3V3 PE_7 GPIO7[7] * ---- ------- ------------- * - * LED is grounded and a high output illuminates the LED. + * A low output illuminates the LED. * * LED index values for use with lpc43_setled() */ diff --git a/configs/lpc4357-evb/src/lpc4357-evb.h b/configs/lpc4357-evb/src/lpc4357-evb.h index fd4d111f1a..2c3fd8caf4 100644 --- a/configs/lpc4357-evb/src/lpc4357-evb.h +++ b/configs/lpc4357-evb/src/lpc4357-evb.h @@ -59,7 +59,7 @@ * D6 LED_3V3 PE_7 GPIO7[7] * ---- ------- ------------- * - * LED is grounded and a high output illuminates the LED. + * A low output illuminates the LED. * * Definitions to configure LED pins as GPIOs: * @@ -72,7 +72,7 @@ /* Definitions to configure LED GPIO as outputs */ -#define GPIO_LED (GPIO_MODE_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT7 | GPIO_PIN7) +#define GPIO_LED (GPIO_MODE_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT7 | GPIO_PIN7) /* Button definitions *******************************************************/ /* to be provided */ diff --git a/configs/lpc4357-evb/src/lpc43_autoleds.c b/configs/lpc4357-evb/src/lpc43_autoleds.c index 3983391c1d..70d832867e 100644 --- a/configs/lpc4357-evb/src/lpc43_autoleds.c +++ b/configs/lpc4357-evb/src/lpc43_autoleds.c @@ -155,21 +155,26 @@ void board_led_initialize(void) void board_led_on(int led) { + bool ledon = true; /* OFF. Low illuminates */ + switch (led) { default: case 0: - lpc43_gpio_write(GPIO_LED, false); /* LED OFF */ - break; + break; /* LED OFF until state 1 */ - case 2: /* LED no change */ - break; + case 2: + return; /* LED no change */ case 1: case 3: - lpc43_gpio_write(GPIO_LED, true); /* LED ON */ + ledon = false; /* LED ON. Low illuminates */ break; } + + /* Turn LED on or off, depending on state */ + + lpc43_gpio_write(GPIO_LED, ledon); } /**************************************************************************** @@ -183,13 +188,16 @@ void board_led_off(int led) default: case 0: case 1: - case 2: - break; /* LED no change */ - case 3: - lpc43_gpio_write(GPIO_LED, false); /* LED OFF */ - break; + break; /* LED OFF */ + + case 2: + return; /* LED no change */ } + + /* LED OFF, Low illuminates */ + + lpc43_gpio_write(GPIO_LED, true); } #endif /* CONFIG_ARCH_LEDS */ diff --git a/configs/lpc4357-evb/src/lpc43_userleds.c b/configs/lpc4357-evb/src/lpc43_userleds.c index c6d532ab7f..1e2816cb2a 100644 --- a/configs/lpc4357-evb/src/lpc43_userleds.c +++ b/configs/lpc4357-evb/src/lpc43_userleds.c @@ -149,7 +149,7 @@ void lpc43_setled(int led, bool ledon) { if (led == BOARD_LED) { - lpc43_gpio_write(GPIO_LED, ledon); + lpc43_gpio_write(GPIO_LED, !ledon); } } @@ -159,7 +159,7 @@ void lpc43_setled(int led, bool ledon) void lpc43_setleds(uint8_t ledset) { - lpc43_gpio_write(GPIO_LED, (ledset & BOARD_LED_BIT) != 0); + lpc43_gpio_write(GPIO_LED, (ledset & BOARD_LED_BIT) == 0); } #endif /* !CONFIG_ARCH_LEDS */ diff --git a/drivers/eeprom/README.txt b/drivers/eeprom/README.txt index c577865d1e..eaa8727c3f 100755 --- a/drivers/eeprom/README.txt +++ b/drivers/eeprom/README.txt @@ -83,12 +83,12 @@ File Systems int losetup(FAR const char *devname, FAR const char *filename, uint16_t sectsize, off_t offset, bool readonly); - Give a file or character devices at 'filename', losetup will create the + Given a file or character devices at 'filename', losetup will create the block device 'devname' using a bogus sector size of sectsize. 'offset' is normally zero but can be used to provide an offset into the EEPROM where the block driver data starts; The EEPROM block driver can also be read- only. - There is a corresponding function that will destory the loop device: + There is a corresponding function that will destroy the loop device: int loteardown(FAR const char *devname);