STM3210E-EVAL: Don't treat joystick as buttons if the DJOYSTICK driver is enabled
This commit is contained in:
parent
3627e078bd
commit
1dcbeab4f4
@ -179,12 +179,19 @@
|
||||
* Joystick left -- Connected to PG.14
|
||||
* Joystick right -- Connected to PG.13
|
||||
* Joystick up -- Connected to PG.15
|
||||
*
|
||||
* The Joystick is treated like the other buttons unless CONFIG_DJOYSTICK
|
||||
* is defined, then it is assumed that they should be used by the discrete
|
||||
* joystick driver.
|
||||
*/
|
||||
|
||||
#define BUTTON_WAKEUP 0
|
||||
#define BUTTON_TAMPER 1
|
||||
#define BUTTON_KEY 2
|
||||
|
||||
#ifdef CONFIG_DJOYSTICK
|
||||
# define NUM_BUTTONS 3
|
||||
#else
|
||||
# define JOYSTICK_SEL 3
|
||||
# define JOYSTICK_DOWN 4
|
||||
# define JOYSTICK_LEFT 5
|
||||
@ -192,16 +199,19 @@
|
||||
# define JOYSTICK_UP 7
|
||||
|
||||
# define NUM_BUTTONS 8
|
||||
#endif
|
||||
|
||||
#define BUTTON_WAKEUP_BIT (1 << BUTTON_WAKEUP)
|
||||
#define BUTTON_TAMPER_BIT (1 << BUTTON_TAMPER)
|
||||
#define BUTTON_KEY_BIT (1 << BUTTON_KEY)
|
||||
|
||||
#ifdef CONFIG_DJOYSTICK
|
||||
# define JOYSTICK_SEL_BIT (1 << JOYSTICK_SEL)
|
||||
# define JOYSTICK_DOWN_BIT (1 << JOYSTICK_DOWN)
|
||||
# define JOYSTICK_LEFT_BIT (1 << JOYSTICK_LEFT)
|
||||
# define JOYSTICK_RIGHT_BIT (1 << JOYSTICK_RIGHT)
|
||||
# define JOYSTICK_UP_BIT (1 << JOYSTICK_UP)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
|
@ -79,9 +79,15 @@
|
||||
|
||||
/* BUTTONS -- NOTE that some have EXTI interrupts configured */
|
||||
|
||||
#ifdef CONFIG_DJOYSTICK
|
||||
# define MIN_IRQBUTTON BUTTON_KEY
|
||||
# define MAX_IRQBUTTON BUTTON_KEY
|
||||
# define NUM_IRQBUTTONS (1)
|
||||
#else
|
||||
# define MIN_IRQBUTTON BUTTON_KEY
|
||||
# define MAX_IRQBUTTON JOYSTICK_UP
|
||||
# define NUM_IRQBUTTONS (JOYSTICK_UP - BUTTON_KEY + 1)
|
||||
#endif
|
||||
|
||||
#define GPIO_BTN_WAKEUP (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
||||
GPIO_PORTA|GPIO_PIN0)
|
||||
@ -89,6 +95,7 @@
|
||||
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|\
|
||||
GPIO_EXTI|GPIO_PORTG|GPIO_PIN7)
|
||||
#define GPIO_JOY_DOWN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
||||
|
@ -61,8 +61,16 @@
|
||||
|
||||
static const uint16_t g_buttons[NUM_BUTTONS] =
|
||||
{
|
||||
GPIO_BTN_WAKEUP, GPIO_BTN_TAMPER, GPIO_BTN_KEY, GPIO_JOY_SEL,
|
||||
GPIO_JOY_DOWN, GPIO_JOY_LEFT, GPIO_JOY_RIGHT, GPIO_JOY_UP
|
||||
GPIO_BTN_WAKEUP, GPIO_BTN_TAMPER, GPIO_BTN_KEY,
|
||||
|
||||
/* The Joystick is treated like the other buttons unless CONFIG_DJOYSTICK
|
||||
* is defined, then it is assumed that they should be used by the discrete
|
||||
* joystick driver.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DJOYSTICK
|
||||
GPIO_JOY_SEL, GPIO_JOY_DOWN, GPIO_JOY_LEFT, GPIO_JOY_RIGHT, GPIO_JOY_UP
|
||||
#endif
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@ -166,6 +174,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler);
|
||||
}
|
||||
|
||||
return oldhandler;
|
||||
}
|
||||
#endif
|
||||
|
@ -64,7 +64,10 @@
|
||||
#endif
|
||||
|
||||
#define BUTTON_MIN 0
|
||||
#ifdef CONFIG_DJOYSTICK
|
||||
# define BUTTON_MAX 2
|
||||
# define BUTTON_MAX 7
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_PM_BUTTONS_MIN
|
||||
# define CONFIG_PM_BUTTONS_MIN BUTTON_MIN
|
||||
@ -76,8 +79,9 @@
|
||||
#if CONFIG_PM_BUTTONS_MIN > CONFIG_PM_BUTTONS_MAX
|
||||
# error "CONFIG_PM_BUTTONS_MIN > CONFIG_PM_BUTTONS_MAX"
|
||||
#endif
|
||||
#if CONFIG_PM_BUTTONS_MAX > 7
|
||||
# error "CONFIG_PM_BUTTONS_MAX > 7"
|
||||
|
||||
#if CONFIG_PM_BUTTONS_MAX > BUTTON_MAX
|
||||
# error "CONFIG_PM_BUTTONS_MAX > BUTTON_MAX"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ARCH_IRQBUTTONS
|
||||
@ -87,6 +91,7 @@
|
||||
#ifndef CONFIG_PM_IRQBUTTONS_MIN
|
||||
# define CONFIG_PM_IRQBUTTONS_MIN CONFIG_PM_BUTTONS_MIN
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_PM_IRQBUTTONS_MAX
|
||||
# define CONFIG_PM_IRQBUTTONS_MAX CONFIG_PM_BUTTONS_MAX
|
||||
#endif
|
||||
@ -94,6 +99,7 @@
|
||||
#if CONFIG_PM_IRQBUTTONS_MIN > CONFIG_PM_IRQBUTTONS_MAX
|
||||
# error "CONFIG_PM_IRQBUTTONS_MIN > CONFIG_PM_IRQBUTTONS_MAX"
|
||||
#endif
|
||||
|
||||
#if CONFIG_PM_IRQBUTTONS_MAX > 7
|
||||
# error "CONFIG_PM_IRQBUTTONS_MAX > 7"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user