From: Cyprien Laplace Date: Sun, 14 Dec 2014 17:05:58 +0000 (+0100) Subject: Make use of the pio and gpio config functions - status_led part X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=62e7991ba69483d2405bbd83672ab4cce8a8f4fa;p=soft%2Flpc122x%2Fcore Make use of the pio and gpio config functions - status_led part --- diff --git a/extdrv/status_led.c b/extdrv/status_led.c index 9b624f9..1e1c28f 100644 --- a/extdrv/status_led.c +++ b/extdrv/status_led.c @@ -27,6 +27,7 @@ #include "core/lpc_regs_12xx.h" #include "core/system.h" #include "core/pio.h" +#include "drivers/gpio.h" #include "extdrv/status_led.h" @@ -51,18 +52,12 @@ void status_led_config(void) { - struct lpc_gpio* gpio1 = LPC_GPIO_REGS(1); - uint32_t mode = (LPC_IO_MODE_PULL_UP | LPC_IO_DIGITAL | LPC_IO_DRIVE_HIGHCURENT); - struct pio red_led = LPC_GPIO_1_5; - struct pio green_led = LPC_GPIO_1_4; - /* Status Led GPIO */ - config_pio(&green_led, mode); - config_pio(&red_led, mode); - /* Configure both as output */ - gpio1->data_dir |= (1 << LED_GREEN) | (1 << LED_RED); - /* Turn both LEDs on */ - //gpio1->set = (1 << LED_GREEN) | (1 << LED_RED); - gpio1->set = (1 << LED_GREEN); + uint32_t mode = LPC_IO_MODE_PULL_UP | LPC_IO_DRIVE_HIGHCURENT; + const struct pio red_led = LPC_GPIO_1_5; + const struct pio green_led = LPC_GPIO_1_4; + /* Status Led GPIO. Turn Green on. */ + config_gpio(&green_led, mode, GPIO_DIR_OUT, 1); + config_gpio(&red_led, mode, GPIO_DIR_OUT, 0); } void status_led(uint32_t val)