summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-11-05 14:07:41 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-11-05 14:07:41 +0000
commit5f6797a5963b61c3b91a0161a9c9f2a373c4a0fe (patch)
tree7cc0a9a2174b975fb0595a69aa3ae766b0b2a543 /nuttx
parentdeab3d6e8ea2a6f4e4cb4f14927e660b5b56156b (diff)
downloadpx4-nuttx-5f6797a5963b61c3b91a0161a9c9f2a373c4a0fe.tar.gz
px4-nuttx-5f6797a5963b61c3b91a0161a9c9f2a373c4a0fe.tar.bz2
px4-nuttx-5f6797a5963b61c3b91a0161a9c9f2a373c4a0fe.zip
Add support for GPIO interrupts & STM3210E-EVAL board buttons
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2226 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/ChangeLog5
-rw-r--r--nuttx/Documentation/NuttX.html6
-rwxr-xr-xnuttx/arch/arm/src/stm32/stm32_gpio.c21
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_gpio.h40
-rwxr-xr-xnuttx/arch/arm/src/stm32/stm32_internal.h8
-rwxr-xr-xnuttx/configs/stm3210e-eval/RIDE/defconfig2
-rwxr-xr-xnuttx/configs/stm3210e-eval/include/board.h64
-rwxr-xr-xnuttx/configs/stm3210e-eval/nsh/defconfig2
-rwxr-xr-xnuttx/configs/stm3210e-eval/ostest/defconfig2
-rwxr-xr-xnuttx/configs/stm3210e-eval/src/Makefile5
-rwxr-xr-xnuttx/configs/stm3210e-eval/src/stm3210e-internal.h21
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_buttons.c112
-rwxr-xr-xnuttx/configs/stm3210e-eval/usbserial/defconfig2
-rw-r--r--nuttx/graphics/README.txt2
14 files changed, 265 insertions, 27 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 73ac116cc..85d2953a6 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -947,3 +947,8 @@
range!
0.4.14 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
+
+ * arch/arm/src/stm32/stm32_gpio.c - Add support for configure an input GPIO
+ to generate an EXTI interrupt.
+ * config/stm3210e-eval/src/up_buttons.c - Add support for on-board buttons.
+
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 04b671484..efa24c38e 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
- <p>Last Updated: October 30, 2009</p>
+ <p>Last Updated: November 5, 2009</p>
</td>
</tr>
</table>
@@ -1596,6 +1596,10 @@ buildroot-0.1.7 2009-06-26 &lt;spudmonkey@racsa.co.cr&gt;
<ul><pre>
nuttx-0.4.14 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+ * arch/arm/src/stm32/stm32_gpio.c - Add support for configure an input GPIO
+ to generate an EXTI interrupt.
+ * config/stm3210e-eval/src/up_buttons.c - Add support for on-board buttons.
+
pascal-0.1.3 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
buildroot-0.1.8 2009-xx-xx &lt;spudmonkey@racsa.co.cr&gt;
diff --git a/nuttx/arch/arm/src/stm32/stm32_gpio.c b/nuttx/arch/arm/src/stm32/stm32_gpio.c
index 454e83351..10bf482cb 100755
--- a/nuttx/arch/arm/src/stm32/stm32_gpio.c
+++ b/nuttx/arch/arm/src/stm32/stm32_gpio.c
@@ -203,9 +203,24 @@ int stm32_configgpio(uint32 cfgset)
}
else
{
- /* It is an input pin... If it is pull-down or pull up,
- * then we need to set the ODR appropriately for that
- * function.
+ /* It is an input pin... Should it configured as an EXTI interrupt? */
+
+ if ((cfgset & GPIO_EXTI) != 0)
+ {
+ int shift;
+
+ /* Yes.. Set the bits in the EXTI CR register */
+
+ regaddr = STM32_AFIO_EXTICR(pin);
+ regval = getreg32(regaddr);
+ shift = AFIO_EXTICR_EXTI_SHIFT(pin);
+ regval &= ~(AFIO_EXTICR_PORT_MASK << shift);
+ regval |= (((uint32)port) << shift);
+ putreg32(regval, regaddr);
+ }
+
+ /* If it is pull-down or pull up, then we need to set the ODR
+ * appropriately for that function.
*/
if ((cfgset & GPIO_CNF_MASK) == GPIO_CNF_INPULLUP)
diff --git a/nuttx/arch/arm/src/stm32/stm32_gpio.h b/nuttx/arch/arm/src/stm32/stm32_gpio.h
index 37cdbba6b..c18d31557 100644
--- a/nuttx/arch/arm/src/stm32/stm32_gpio.h
+++ b/nuttx/arch/arm/src/stm32/stm32_gpio.h
@@ -62,6 +62,7 @@
#define STM32_AFIO_EVCR_OFFSET 0x0000 /* Event control register */
#define STM32_AFIO_MAPR_OFFSET 0x0004 /* AF remap and debug I/O configuration register */
+#define STM32_AFIO_EXTICR_OFFSET(p) (0x0008 + ((p) >> 2))
#define STM32_AFIO_EXTICR1_OFFSET 0x0008 /* External interrupt configuration register 1 */
#define STM32_AFIO_EXTICR2_OFFSET 0x000c /* External interrupt configuration register 2 */
#define STM32_AFIO_EXTICR3_OFFSET 0x0010 /* External interrupt configuration register 3 */
@@ -141,6 +142,7 @@
#define STM32_AFIO_EVCR (STM32_AFIO_BASE+STM32_AFIO_EVCR_OFFSET)
#define STM32_AFIO_MAPR (STM32_AFIO_BASE+STM32_AFIO_MAPR_OFFSET)
+#define STM32_AFIO_EXTICR(p) (STM32_AFIO_BASE+STM32_AFIO_EXTICR_OFFSET(p))
#define STM32_AFIO_EXTICR1 (STM32_AFIO_BASE+STM32_AFIO_EXTICR1_OFFSET)
#define STM32_AFIO_EXTICR2 (STM32_AFIO_BASE+STM32_AFIO_EXTICR3_OFFSET)
#define STM32_AFIO_EXTICR3 (STM32_AFIO_BASE+STM32_AFIO_EXTICR3_OFFSET)
@@ -312,53 +314,59 @@
/* External interrupt configuration register 1 */
+#define AFIO_EXTICR_PORT_MASK (0x0f)
+#define AFIO_EXTICR_EXTI_SHIFT(g) (((g) & 3) << 2)
+#define AFIO_EXTICR_EXTI_MASK(g) (AFIO_EXTICR_PORT_MASK << (AFIO_EXTICR_EXTI_SHIFT(g)))
+
#define AFIO_EXTICR1_EXTI0_SHIFT (0) /* Bits 3-0: EXTI 0 configuration */
-#define AFIO_EXTICR1_EXTI0_MASK (0x0f << AFIO_EXTICR1_EXTI0_SHIFT)
+#define AFIO_EXTICR1_EXTI0_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR1_EXTI0_SHIFT)
#define AFIO_EXTICR1_EXTI1_SHIFT (4) /* Bits 7-4: EXTI 1 configuration */
-#define AFIO_EXTICR1_EXTI1_MASK (0x0f << AFIO_EXTICR1_EXTI1_SHIFT)
+#define AFIO_EXTICR1_EXTI1_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR1_EXTI1_SHIFT)
#define AFIO_EXTICR1_EXTI2_SHIFT (8) /* Bits 11-8: EXTI 2 configuration */
-#define AFIO_EXTICR1_EXTI2_MASK (0x0f << AFIO_EXTICR1_EXTI2_SHIFT)
+#define AFIO_EXTICR1_EXTI2_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR1_EXTI2_SHIFT)
#define AFIO_EXTICR1_EXTI3_SHIFT (12) /* Bits 15-12: EXTI 3 configuration */
-#define AFIO_EXTICR1_EXTI3_MASK (0x0f << AFIO_EXTICR1_EXTI3_SHIFT)
+#define AFIO_EXTICR1_EXTI3_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR1_EXTI3_SHIFT)
#define AFIO_EXTICR_PORTA (0) /* 0000: PA[x] pin */
#define AFIO_EXTICR_PORTB (1) /* 0001: PB[x] pin */
#define AFIO_EXTICR_PORTC (2) /* 0010: PC[x] pin */
#define AFIO_EXTICR_PORTD (3) /* 0011: PD[x] pin */
#define AFIO_EXTICR_PORTE (4) /* 0100: PE[x] pin */
+#define AFIO_EXTICR_PORTF (5) /* 0101: PF[x] pin */
+#define AFIO_EXTICR_PORTG (6) /* 0110: PG[x] pin */
/* External interrupt configuration register 2 */
#define AFIO_EXTICR2_EXTI4_SHIFT (0) /* Bits 3-0: EXTI 4 configuration */
-#define AFIO_EXTICR2_EXTI4_MASK (0x0f << AFIO_EXTICR2_EXTI4_SHIFT)
+#define AFIO_EXTICR2_EXTI4_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR2_EXTI4_SHIFT)
#define AFIO_EXTICR2_EXTI5_SHIFT (4) /* Bits 7-4: EXTI 5 configuration */
-#define AFIO_EXTICR2_EXTI5_MASK (0x0f << AFIO_EXTICR2_EXTI5_SHIFT)
+#define AFIO_EXTICR2_EXTI5_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR2_EXTI5_SHIFT)
#define AFIO_EXTICR2_EXTI6_SHIFT (8) /* Bits 11-8: EXTI 6 configuration */
-#define AFIO_EXTICR2_EXTI6_MASK (0x0f << AFIO_EXTICR2_EXTI6_SHIFT)
+#define AFIO_EXTICR2_EXTI6_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR2_EXTI6_SHIFT)
#define AFIO_EXTICR2_EXTI7_SHIFT (12) /* Bits 15-12: EXTI 7 configuration */
-#define AFIO_EXTICR2_EXTI7_MASK (0x0f << AFIO_EXTICR2_EXTI7_SHIFT)
+#define AFIO_EXTICR2_EXTI7_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR2_EXTI7_SHIFT)
/* External interrupt configuration register 3 */
#define AFIO_EXTICR3_EXTI8_SHIFT (0) /* Bits 3-0: EXTI 8 configuration */
-#define AFIO_EXTICR3_EXTI8_MASK (0x0f << AFIO_EXTICR3_EXTI8_SHIFT)
+#define AFIO_EXTICR3_EXTI8_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR3_EXTI8_SHIFT)
#define AFIO_EXTICR3_EXTI9_SHIFT (4) /* Bits 7-4: EXTI 9 configuration */
-#define AFIO_EXTICR3_EXTI9_MASK (0x0f << AFIO_EXTICR3_EXTI9_SHIFT)
+#define AFIO_EXTICR3_EXTI9_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR3_EXTI9_SHIFT)
#define AFIO_EXTICR3_EXTI10_SHIFT (8) /* Bits 11-8: EXTI 10 configuration */
-#define AFIO_EXTICR3_EXTI10_MASK (0x0f << AFIO_EXTICR3_EXTI10_SHIFT)
+#define AFIO_EXTICR3_EXTI10_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR3_EXTI10_SHIFT)
#define AFIO_EXTICR3_EXTI11_SHIFT (12) /* Bits 15-12: EXTI 11 configuration */
-#define AFIO_EXTICR3_EXTI11_MASK (0x0f << AFIO_EXTICR3_EXTI11_SHIFT)
+#define AFIO_EXTICR3_EXTI11_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR3_EXTI11_SHIFT)
/* External interrupt configuration register 4 */
#define AFIO_EXTICR4_EXTI12_SHIFT (0) /* Bits 3-0: EXTI 12 configuration */
-#define AFIO_EXTICR4_EXTI12_MASK (0x0f << AFIO_EXTICR4_EXTI12_SHIFT)
+#define AFIO_EXTICR4_EXTI12_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR4_EXTI12_SHIFT)
#define AFIO_EXTICR4_EXTI13_SHIFT (4) /* Bits 7-4: EXTI 13 configuration */
-#define AFIO_EXTICR4_EXTI13_MASK (0x0f << AFIO_EXTICR4_EXTI13_SHIFT)
+#define AFIO_EXTICR4_EXTI13_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR4_EXTI13_SHIFT)
#define AFIO_EXTICR4_EXTI14_SHIFT (8) /* Bits 11-8: EXTI 14 configuration */
-#define AFIO_EXTICR4_EXTI14_MASK (0x0f << AFIO_EXTICR4_EXTI14_SHIFT)
+#define AFIO_EXTICR4_EXTI14_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR4_EXTI14_SHIFT)
#define AFIO_EXTICR4_EXTI15_SHIFT (12) /* Bits 15-12: EXTI 15 configuration */
-#define AFIO_EXTICR4_EXTI15_MASK (0x0f << AFIO_EXTICR4_EXTI15_SHIFT)
+#define AFIO_EXTICR4_EXTI15_MASK (AFIO_EXTICR_PORT_MASK << AFIO_EXTICR4_EXTI15_SHIFT)
/************************************************************************************
* Public Types
diff --git a/nuttx/arch/arm/src/stm32/stm32_internal.h b/nuttx/arch/arm/src/stm32/stm32_internal.h
index 374c1bd33..2a464c0bf 100755
--- a/nuttx/arch/arm/src/stm32/stm32_internal.h
+++ b/nuttx/arch/arm/src/stm32/stm32_internal.h
@@ -59,7 +59,7 @@
/* Bit-encoded input to stm32_configgpio() *******************************************/
/* 16-bit Encoding:
- * OFFS S... VPPP BBBB
+ * OFFS SX.. VPPP BBBB
*/
/* Output mode:
@@ -99,6 +99,12 @@
# define GPIO_MODE_2MHz (2 << GPIO_MODE_SHIFT) /* Output mode, max speed 2 MHz */
# define GPIO_MODE_50MHz (3 << GPIO_MODE_SHIFT) /* Output mode, max speed 50 MHz */
+/* External interrupt selection (GPIO inputs only):
+ * .... .X.. .... ....
+ */
+
+#define GPIO_EXTI (1 << 10) /* Bit 10: Configure as EXTI interrupt */
+
/* If the pin is an GPIO digital output, then this identifies the initial output value:
* .... .... V... ....
*/
diff --git a/nuttx/configs/stm3210e-eval/RIDE/defconfig b/nuttx/configs/stm3210e-eval/RIDE/defconfig
index 6bb7331ad..3f7bfec5a 100755
--- a/nuttx/configs/stm3210e-eval/RIDE/defconfig
+++ b/nuttx/configs/stm3210e-eval/RIDE/defconfig
@@ -60,6 +60,7 @@
# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
# CONFIG_ARCH_BOOTLOADER - Set if you are using a bootloader.
# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+# CONFIG_ARCH_BUTTONS - Enable support for buttons. Unique to board architecture.
# CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
# cause a 100 second delay during boot-up. This 100 second delay
# serves no purpose other than it allows you to calibrate
@@ -83,6 +84,7 @@ CONFIG_ARCH_INTERRUPTSTACK=n
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_BOOTLOADER=n
CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
CONFIG_ARCH_CALIBRATION=n
#
diff --git a/nuttx/configs/stm3210e-eval/include/board.h b/nuttx/configs/stm3210e-eval/include/board.h
index 9968957c2..c753d0650 100755
--- a/nuttx/configs/stm3210e-eval/include/board.h
+++ b/nuttx/configs/stm3210e-eval/include/board.h
@@ -102,12 +102,51 @@
#define LED_ASSERTION 6 /* LED1 + LED2 + LED3 */
#define LED_PANIC 7 /* N/C + N/C + N/C + LED4 */
+/* The STM3210E-EVAL supports several buttons
+ *
+ * Reset -- Connected to NRST
+ * Wakeup -- Connected to PA.0
+ * Tamper -- Connected to PC.13
+ * Key -- Connected to PG.8
+ *
+ * And a Joystick
+ *
+ * Joystick center -- Connected to PG.7
+ * Joystick down -- Connected to PD.3
+ * Joystick left -- Connected to PG.14
+ * Joystick right -- Connected to PG.13
+ * Joystick up -- Connected to PG.15
+ */
+
+#define BUTTON_WAKEUP (1 << 0)
+#define BUTTON_TAMPER (1 << 1)
+#define BUTTON_KEY (1 << 2)
+
+#define JOYSTICK_SEL (1 << 3)
+#define JOYSTICK_DOWN (1 << 4)
+#define JOYSTICK_LEFT (1 << 5)
+#define JOYSTICK_RIGHT (1 << 6)
+#define JOYSTICK_UP (1 << 7)
+
+#define NUM_BUTTONS 8
+
/************************************************************************************
- * Public Function Prototypes
+ * Public Data
************************************************************************************/
#ifndef __ASSEMBLY__
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
/************************************************************************************
* Name: stm32_boardinitialize
*
@@ -118,7 +157,28 @@
*
************************************************************************************/
-extern void stm32_boardinitialize(void);
+EXTERN void stm32_boardinitialize(void);
+
+/************************************************************************************
+ * Button support.
+ *
+ * Description:
+ * up_buttoninit() must be called to initialize button resources. After that,
+ * up_buttons() may be called to collect the state of all buttons. up_buttons()
+ * returns an 8-bit bit set with each bit associated with a button. See the
+ * BUTTON_* and JOYSTICK_* definitions above for the meaning of each bit.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_ARCH_BUTTONS
+EXTERN void up_buttoninit(void);
+EXTERN ubyte up_buttons(void);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/nuttx/configs/stm3210e-eval/nsh/defconfig b/nuttx/configs/stm3210e-eval/nsh/defconfig
index 842f5951a..a3d22defd 100755
--- a/nuttx/configs/stm3210e-eval/nsh/defconfig
+++ b/nuttx/configs/stm3210e-eval/nsh/defconfig
@@ -60,6 +60,7 @@
# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
# CONFIG_ARCH_BOOTLOADER - Set if you are using a bootloader.
# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+# CONFIG_ARCH_BUTTONS - Enable support for buttons. Unique to board architecture.
# CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
# cause a 100 second delay during boot-up. This 100 second delay
# serves no purpose other than it allows you to calibrate
@@ -83,6 +84,7 @@ CONFIG_ARCH_INTERRUPTSTACK=n
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_BOOTLOADER=n
CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
CONFIG_ARCH_CALIBRATION=n
#
diff --git a/nuttx/configs/stm3210e-eval/ostest/defconfig b/nuttx/configs/stm3210e-eval/ostest/defconfig
index 06b8df95d..1d18778fe 100755
--- a/nuttx/configs/stm3210e-eval/ostest/defconfig
+++ b/nuttx/configs/stm3210e-eval/ostest/defconfig
@@ -60,6 +60,7 @@
# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
# CONFIG_ARCH_BOOTLOADER - Set if you are using a bootloader.
# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+# CONFIG_ARCH_BUTTONS - Enable support for buttons. Unique to board architecture.
# CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
# cause a 100 second delay during boot-up. This 100 second delay
# serves no purpose other than it allows you to calibrate
@@ -83,6 +84,7 @@ CONFIG_ARCH_INTERRUPTSTACK=n
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_BOOTLOADER=n
CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
CONFIG_ARCH_CALIBRATION=n
#
diff --git a/nuttx/configs/stm3210e-eval/src/Makefile b/nuttx/configs/stm3210e-eval/src/Makefile
index 3e3576ee9..b3e82e7af 100755
--- a/nuttx/configs/stm3210e-eval/src/Makefile
+++ b/nuttx/configs/stm3210e-eval/src/Makefile
@@ -39,8 +39,9 @@ CFLAGS += -I$(TOPDIR)/sched
ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))
-CSRCS = up_boot.c up_leds.c up_spi.c up_usbdev.c up_extcontext.c \
- up_selectnor.c up_deselectnor.c up_selectsram.c up_deselectsram.c
+CSRCS = up_boot.c up_leds.c up_buttons.c up_spi.c up_usbdev.c \
+ up_extcontext.c up_selectnor.c up_deselectnor.c \
+ up_selectsram.c up_deselectsram.c
ifeq ($(CONFIG_EXAMPLES_NSH_ARCHINIT),y)
CSRCS += up_nsh.c
endif
diff --git a/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h b/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h
index 897f2a5ca..64101af73 100755
--- a/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h
+++ b/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h
@@ -72,7 +72,26 @@
#define GPIO_LED3 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN8)
#define GPIO_LED4 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
- GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN9)
+ GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN9)
+
+/* BUTTONS -- NOTE that some have EXTI interrupts configured */
+
+#define GPIO_BTN_WAKEUP (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_PORTA|GPIO_PIN0)
+#define GPIO_BTN_TAMPER (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_PORTA|GPIO_PIN0)
+#define GPIO_BTN_KEY (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTG|GPIO_PIN8)
+#define GPIO_JOY_KEY (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTG|GPIO_PIN7)
+#define GPIO_JOY_DOWN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTD|GPIO_PIN3)
+#define GPIO_JOY_LEFT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTG|GPIO_PIN14)
+#define GPIO_JOY_RIGHT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTG|GPIO_PIN13)
+#define GPIO_JOY_UP (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+ GPIO_EXTI|GPIO_PORTG|GPIO_PIN15)
/* SPI FLASH chip select: PA.4 */
diff --git a/nuttx/configs/stm3210e-eval/src/up_buttons.c b/nuttx/configs/stm3210e-eval/src/up_buttons.c
new file mode 100644
index 000000000..67b8537c7
--- /dev/null
+++ b/nuttx/configs/stm3210e-eval/src/up_buttons.c
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * configs/stm3210e-eval/src/up_leds.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <sys/types.h>
+
+#include <arch/board/board.h>
+#include "stm3210e-internal.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const uint16 g_buttons[NUM_BUTTONS] =
+{
+ GPIO_BTN_WAKEUP, GPIO_BTN_TAMPER, GPIO_BTN_KEY, GPIO_JOY_KEY,
+ GPIO_JOY_DOWN, GPIO_JOY_LEFT, GPIO_JOY_RIGHT, GPIO_JOY_UP
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_buttoninit
+ ****************************************************************************/
+
+void up_buttoninit(void)
+{
+ int i;
+
+ /* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are
+ * configured for some pins but NOT used in this file
+ */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ stm32_configgpio(g_buttons[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: up_buttons
+ ****************************************************************************/
+
+ubyte up_buttons(void)
+{
+ ubyte ret = 0;
+ int i;
+
+ /* Check that state of each key */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ /* A LOW value means that the key is pressed */
+
+ if (!stm32_gpioread(g_buttons[i]))
+ {
+ ret |= (1 << i);
+ }
+ }
+
+ return ret;
+}
+
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/nuttx/configs/stm3210e-eval/usbserial/defconfig b/nuttx/configs/stm3210e-eval/usbserial/defconfig
index 1ee43d1cb..0917bc2f1 100755
--- a/nuttx/configs/stm3210e-eval/usbserial/defconfig
+++ b/nuttx/configs/stm3210e-eval/usbserial/defconfig
@@ -60,6 +60,7 @@
# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
# CONFIG_ARCH_BOOTLOADER - Set if you are using a bootloader.
# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+# CONFIG_ARCH_BUTTONS - Enable support for buttons. Unique to board architecture.
# CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
# cause a 100 second delay during boot-up. This 100 second delay
# serves no purpose other than it allows you to calibrate
@@ -83,6 +84,7 @@ CONFIG_ARCH_INTERRUPTSTACK=n
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_BOOTLOADER=n
CONFIG_ARCH_LEDS=y
+CONFIG_ARCH_BUTTONS=n
CONFIG_ARCH_CALIBRATION=n
#
diff --git a/nuttx/graphics/README.txt b/nuttx/graphics/README.txt
index 44127a53c..1822067ad 100644
--- a/nuttx/graphics/README.txt
+++ b/nuttx/graphics/README.txt
@@ -59,7 +59,7 @@ graphics/nxsu
single user front-end is selected when CONFIG_NX_MULTIUSER is not defined in the
NuttX configuration file.
-graphics/nxsu
+graphics/nxmu
This is the NX multi user "front end". When combined with the generic "back-end"
(nxbe), it implements a multi-threaded, multi-user windowing system. The files
in this directory present the window APIs described in include/nuttx/nx.h. The