From 458d6b127b21800a20edebe809153046ad9908aa Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 30 Sep 2009 15:03:25 +0000 Subject: [PATCH] Add LED support git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2108 42af7a65-404d-4744-a932-0658087f49c3 --- arch/arm/src/stm32/stm32_gpio.c | 4 ++-- arch/arm/src/stm32/stm32_internal.h | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/arch/arm/src/stm32/stm32_gpio.c b/arch/arm/src/stm32/stm32_gpio.c index 053d4b44bcd..33c4296aa64 100755 --- a/arch/arm/src/stm32/stm32_gpio.c +++ b/arch/arm/src/stm32/stm32_gpio.c @@ -140,7 +140,7 @@ int stm32_configgpio(uint32 cfgset) /* Input or output? */ - output = ((cfgset & GPIO_OUTPUT_PIN) != 0); + output = ((cfgset & GPIO_OUTPUT) != 0); /* Decode the mode and configuration */ @@ -170,7 +170,7 @@ int stm32_configgpio(uint32 cfgset) * pin output value */ - if ((cfgset & GPIO_OUTPUT_VALUE) != 0) + if ((cfgset & GPIO_OUTPUT_SET) != 0) { /* Use the BSRR register to set the output */ diff --git a/arch/arm/src/stm32/stm32_internal.h b/arch/arm/src/stm32/stm32_internal.h index 800c9c90350..b45bacabb4d 100755 --- a/arch/arm/src/stm32/stm32_internal.h +++ b/arch/arm/src/stm32/stm32_internal.h @@ -67,7 +67,8 @@ * .... .... .... .... O... .... VPPP BBBB */ -#define GPIO_OUTPUT_PIN (1 << 15) /* Bit 15: Output mode */ +#define GPIO_OUTPUT (1 << 15) /* Bit 15: Output mode */ +#define GPIO_INPUT (0) /* These bits set the primary function of the pin: * .... .... .... .... FFF. .... .... .... @@ -101,7 +102,8 @@ * .... .... .... .... .... .... V... .... */ -#define GPIO_OUTPUT_VALUE (1 << 7) /* Bit 7: If output, inital value of output */ +#define GPIO_OUTPUT_SET (1 << 7) /* Bit 7: If output, inital value of output */ +#define GPIO_OUTPUT_CLEAR (0) /* This identifies the GPIO port: * .... .... .... .... .... .... .PPP .... @@ -123,6 +125,21 @@ #define GPIO_PIN_SHIFT 0 /* Bits 0-3: GPIO number: 0-15 */ #define GPIO_PIN_MASK (15 << GPIO_PIN_SHIFT) +#define GPIO_PIN1 (1 << GPIO_PIN_SHIFT) +#define GPIO_PIN2 (2 << GPIO_PIN_SHIFT) +#define GPIO_PIN3 (3 << GPIO_PIN_SHIFT) +#define GPIO_PIN4 (4 << GPIO_PIN_SHIFT) +#define GPIO_PIN5 (5 << GPIO_PIN_SHIFT) +#define GPIO_PIN6 (6 << GPIO_PIN_SHIFT) +#define GPIO_PIN7 (7 << GPIO_PIN_SHIFT) +#define GPIO_PIN8 (8 << GPIO_PIN_SHIFT) +#define GPIO_PIN9 (9 << GPIO_PIN_SHIFT) +#define GPIO_PIN10 (10 << GPIO_PIN_SHIFT) +#define GPIO_PIN11 (11 << GPIO_PIN_SHIFT) +#define GPIO_PIN12 (12 << GPIO_PIN_SHIFT) +#define GPIO_PIN13 (13 << GPIO_PIN_SHIFT) +#define GPIO_PIN14 (14 << GPIO_PIN_SHIFT) +#define GPIO_PIN15 (15 << GPIO_PIN_SHIFT) /************************************************************************************ * Public Types