diff --git a/configs/lpc4357-evb/README.txt b/configs/lpc4357-evb/README.txt index 694343a447e..12a166866c9 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 5e23e4cb8a9..e882a103e9e 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 fd4d111f1a9..2c3fd8caf48 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 3983391c1df..70d832867ee 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 c6d532ab7f3..1e2816cb2ad 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 */