Verified STM3210E-EVAL button handling and new button test application

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3751 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-07-07 18:40:15 +00:00
parent c472fe3913
commit 98f4235996
5 changed files with 35 additions and 8 deletions
+6
View File
@@ -1869,3 +1869,9 @@
are trying to using multiple UARTs on STM32.
* configs/stm3210e-eval/src/up_lcd.c: Add a driver for the STM3210E-EVAL's LCD.
* configs/stm3210e-eval/nx: Add NX configuration for the STM3210E-EVAL.
* configs/nuttx/arch.h (and arch/arm/src/stm32, configs/*/src/up_buttons.c):
Standardize interfaces exported for button support and button interrupts.
* configs/stm3210e-eval/src/up_buttons.c - Add interrupting button support.
Also fixes a few errors in STM3210E-EVAL button decoding.
* configs/stm3210e-eval/buttons: Add a configuration to exercise STM3210E-EVAL
buttons.
+11 -2
View File
@@ -684,14 +684,23 @@ CONFIG_EXAMPLE_NETTEST_CLIENTIP=(10<<24|0<<16|0<<8|1)
# Settings for examples/buttons
#
# CONFIG_EXAMPLE_BUTTONS_MIN and CONFIG_EXAMPLE_BUTTONS_MAX
# Lowest and highest button number
# Lowest and highest button number (0-7)
# CONFIG_EXAMPLE_IRQBUTTONS_MIN and CONFIG_EXAMPLE_IRQBUTTONS_MAX
# Lowest and highest interrupting button number
# Lowest and highest interrupting button number (-7)
# CONFIG_EXAMPLE_BUTTONS_NAMEn - Name for button n
#
CONFIG_EXAMPLE_BUTTONS_MIN=0
CONFIG_EXAMPLE_BUTTONS_MAX=7
CONFIG_EXAMPLE_IRQBUTTONS_MIN=2
CONFIG_EXAMPLE_IRQBUTTONS_MAX=7
CONFIG_EXAMPLE_BUTTONS_NAME0="WAKEUP"
CONFIG_EXAMPLE_BUTTONS_NAME1="TAMPER"
CONFIG_EXAMPLE_BUTTONS_NAME2="KEY"
CONFIG_EXAMPLE_BUTTONS_NAME3="SELECT"
CONFIG_EXAMPLE_BUTTONS_NAME4="DOWN"
CONFIG_EXAMPLE_BUTTONS_NAME5="LEFT"
CONFIG_EXAMPLE_BUTTONS_NAME6="RIGHT"
CONFIG_EXAMPLE_BUTTONS_NAME7="UP"
#
# Settings for examples/ostest
@@ -83,7 +83,7 @@
#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)
GPIO_PORTC|GPIO_PIN13)
#define GPIO_BTN_KEY (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
GPIO_EXTI|GPIO_PORTG|GPIO_PIN8)
#define GPIO_JOY_SEL (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
+13 -3
View File
@@ -109,11 +109,21 @@ uint8_t up_buttons(void)
for (i = 0; i < NUM_BUTTONS; i++)
{
/* A LOW value means that the key is pressed */
/* A LOW value means that the key is pressed for most keys. The exception
* is the WAKEUP button.
*/
if (!stm32_gpioread(g_buttons[i]))
bool released = stm32_gpioread(g_buttons[i]);
if (i == BUTTON_WAKEUP)
{
ret |= (1 << i);
released = !released;
}
/* Accumulate the set of depressed (not released) keys */
if (!released)
{
ret |= (1 << i);
}
}
+4 -2
View File
@@ -560,8 +560,10 @@ EXTERN void up_buttoninit(void);
* Description:
* After up_buttoninit() has been called, 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. The meaning of the each button
* bit is board-specific.
* with each bit associated with a button. A bit set to "1" means that the
* button is depressed; a bit set to "0" means that the button is released.
* The correspondence of the each button bit and physical buttons is board-
* specific.
*
* NOTE: This interface may or may not be supported by board-specific
* logic. If the board supports button interfaces, then CONFIG_ARCH_BUTTONS