Nucleo-f402re: Add an option to use only a minimal set of joystick buttons. This eliminates some GPIO conflicts

This commit is contained in:
Gregory Nutt 2014-12-04 10:58:13 -06:00
parent b844e92ffa
commit 6d7002cf62
4 changed files with 44 additions and 7 deletions

View File

@ -2,3 +2,20 @@
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
if ARCH_BOARD_NUCLEO_F401RE
config NUCLEO_F401RE_AJOY_MINBUTTONS
bool "Minimal Joystick Buttons"
default n if !STM32_USART1
default y if STM32_USART1
depends on AJOYSTICK
---help---
The Itead Joystick shield supports analog X/Y position and up to 5
buttons. Some of these buttons may conflict with other resources
(Button F, for example, conflicts with the default USART1 pin usage).
Selecting this option will return the number of buttons to the
minimal set: SELECT (joystick down), FIRE (BUTTON B), and JUMP
(BUTTON A).
endif # ARCH_BOARD_NUCLEO_F401RE

View File

@ -539,7 +539,8 @@ Shields
NOTE: Button F cannot be used with the default USART1 configuration
because PA9 is configured for USART1_RX by default. Use select
different USART1 pins in the board.h file or select a different
USART
USART or select CONFIG_NUCLEO_F401RE_AJOY_MINBUTTONS which will
eliminate all but buttons A, B, and C.
Itead Joystick Signal interpretation:

View File

@ -197,7 +197,8 @@
* NOTE: Button F cannot be used with the default USART1 configuration
* because PA9 is configured for USART1_RX by default. Use select
* different USART1 pins in the board.h file or select a different
* USART
* USART or select CONFIG_NUCLEO_F401RE_AJOY_MINBUTTONS which will
* eliminate all but buttons A, B, and C.
*/
#define ADC_XOUPUT 1 /* X output is on ADC channel 1 */

View File

@ -85,16 +85,27 @@
# define NJOYSTICK_CHANNELS 1
#endif
#ifdef CONFIG_NUCLEO_F401RE_AJOY_MINBUTTONS
/* Number of Joystick buttons */
#define AJOY_NGPIOS 7
# define AJOY_NGPIOS 3
/* Bitset of supported Joystick buttons */
#define AJOY_SUPPORTED (AJOY_BUTTON_1_BIT | AJOY_BUTTON_2_BIT | \
AJOY_BUTTON_3_BIT | AJOY_BUTTON_4_BIT | \
AJOY_BUTTON_5_BIT | AJOY_BUTTON_6_BIT | \
AJOY_BUTTON_7_BIT )
# define AJOY_SUPPORTED (AJOY_BUTTON_1_BIT | AJOY_BUTTON_2_BIT | \
AJOY_BUTTON_3_BIT)
#else
/* Number of Joystick buttons */
# define AJOY_NGPIOS 7
/* Bitset of supported Joystick buttons */
# define AJOY_SUPPORTED (AJOY_BUTTON_1_BIT | AJOY_BUTTON_2_BIT | \
AJOY_BUTTON_3_BIT | AJOY_BUTTON_4_BIT | \
AJOY_BUTTON_5_BIT | AJOY_BUTTON_6_BIT | \
AJOY_BUTTON_7_BIT )
#endif
/****************************************************************************
* Private Types
@ -122,11 +133,18 @@ static int ajoy_interrupt(int irq, FAR void *context);
* button definitions in include/nuttx/input/ajoystick.h.
*/
#ifdef CONFIG_NUCLEO_F401RE_AJOY_MINBUTTONS
static const uint32_t g_joygpio[AJOY_NGPIOS] =
{
GPIO_BUTTON_1, GPIO_BUTTON_2, GPIO_BUTTON_3
};
#else
static const uint32_t g_joygpio[AJOY_NGPIOS] =
{
GPIO_BUTTON_1, GPIO_BUTTON_2, GPIO_BUTTON_3, GPIO_BUTTON_4,
GPIO_BUTTON_5, GPIO_BUTTON_6, GPIO_BUTTON_7
};
#endif
/* This is the button joystick lower half driver interface */