From 62e7991ba69483d2405bbd83672ab4cce8a8f4fa Mon Sep 17 00:00:00 2001 From: Cyprien Laplace Date: Sun, 14 Dec 2014 18:05:58 +0100 Subject: [PATCH] Make use of the pio and gpio config functions - status_led part --- extdrv/status_led.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) 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) -- 2.43.0