STM3210E-EVAL: Don't treat joystick as buttons if the DJOYSTICK driver is enabled
This commit is contained in:
parent
997fa4b749
commit
33cfa5d8ba
@ -167,41 +167,51 @@
|
|||||||
|
|
||||||
/* The STM3210E-EVAL supports several buttons
|
/* The STM3210E-EVAL supports several buttons
|
||||||
*
|
*
|
||||||
* Reset -- Connected to NRST
|
* Reset -- Connected to NRST
|
||||||
* Wakeup -- Connected to PA.0
|
* Wakeup -- Connected to PA.0
|
||||||
* Tamper -- Connected to PC.13
|
* Tamper -- Connected to PC.13
|
||||||
* Key -- Connected to PG.8
|
* Key -- Connected to PG.8
|
||||||
*
|
*
|
||||||
* And a Joystick
|
* And a Joystick
|
||||||
*
|
*
|
||||||
* Joystick center -- Connected to PG.7
|
* Joystick center -- Connected to PG.7
|
||||||
* Joystick down -- Connected to PD.3
|
* Joystick down -- Connected to PD.3
|
||||||
* Joystick left -- Connected to PG.14
|
* Joystick left -- Connected to PG.14
|
||||||
* Joystick right -- Connected to PG.13
|
* Joystick right -- Connected to PG.13
|
||||||
* Joystick up -- Connected to PG.15
|
* 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_WAKEUP 0
|
||||||
#define BUTTON_TAMPER 1
|
#define BUTTON_TAMPER 1
|
||||||
#define BUTTON_KEY 2
|
#define BUTTON_KEY 2
|
||||||
|
|
||||||
#define JOYSTICK_SEL 3
|
#ifdef CONFIG_DJOYSTICK
|
||||||
#define JOYSTICK_DOWN 4
|
# define NUM_BUTTONS 3
|
||||||
#define JOYSTICK_LEFT 5
|
#else
|
||||||
#define JOYSTICK_RIGHT 6
|
# define JOYSTICK_SEL 3
|
||||||
#define JOYSTICK_UP 7
|
# define JOYSTICK_DOWN 4
|
||||||
|
# define JOYSTICK_LEFT 5
|
||||||
|
# define JOYSTICK_RIGHT 6
|
||||||
|
# define JOYSTICK_UP 7
|
||||||
|
|
||||||
#define NUM_BUTTONS 8
|
# define NUM_BUTTONS 8
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BUTTON_WAKEUP_BIT (1 << BUTTON_WAKEUP)
|
#define BUTTON_WAKEUP_BIT (1 << BUTTON_WAKEUP)
|
||||||
#define BUTTON_TAMPER_BIT (1 << BUTTON_TAMPER)
|
#define BUTTON_TAMPER_BIT (1 << BUTTON_TAMPER)
|
||||||
#define BUTTON_KEY_BIT (1 << BUTTON_KEY)
|
#define BUTTON_KEY_BIT (1 << BUTTON_KEY)
|
||||||
|
|
||||||
#define JOYSTICK_SEL_BIT (1 << JOYSTICK_SEL)
|
#ifdef CONFIG_DJOYSTICK
|
||||||
#define JOYSTICK_DOWN_BIT (1 << JOYSTICK_DOWN)
|
# define JOYSTICK_SEL_BIT (1 << JOYSTICK_SEL)
|
||||||
#define JOYSTICK_LEFT_BIT (1 << JOYSTICK_LEFT)
|
# define JOYSTICK_DOWN_BIT (1 << JOYSTICK_DOWN)
|
||||||
#define JOYSTICK_RIGHT_BIT (1 << JOYSTICK_RIGHT)
|
# define JOYSTICK_LEFT_BIT (1 << JOYSTICK_LEFT)
|
||||||
#define JOYSTICK_UP_BIT (1 << JOYSTICK_UP)
|
# define JOYSTICK_RIGHT_BIT (1 << JOYSTICK_RIGHT)
|
||||||
|
# define JOYSTICK_UP_BIT (1 << JOYSTICK_UP)
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
|
@ -68,42 +68,49 @@
|
|||||||
/* STM3210E-EVAL GPIOs **************************************************************/
|
/* STM3210E-EVAL GPIOs **************************************************************/
|
||||||
/* LEDs */
|
/* LEDs */
|
||||||
|
|
||||||
#define GPIO_LED1 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
|
#define GPIO_LED1 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
|
||||||
GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN6)
|
GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN6)
|
||||||
#define GPIO_LED2 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
|
#define GPIO_LED2 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
|
||||||
GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN7)
|
GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN7)
|
||||||
#define GPIO_LED3 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
|
#define GPIO_LED3 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
|
||||||
GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN8)
|
GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN8)
|
||||||
#define GPIO_LED4 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
|
#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 */
|
/* BUTTONS -- NOTE that some have EXTI interrupts configured */
|
||||||
|
|
||||||
#define MIN_IRQBUTTON BUTTON_KEY
|
#ifdef CONFIG_DJOYSTICK
|
||||||
#define MAX_IRQBUTTON JOYSTICK_UP
|
# define MIN_IRQBUTTON BUTTON_KEY
|
||||||
#define NUM_IRQBUTTONS (JOYSTICK_UP - BUTTON_KEY + 1)
|
# 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|\
|
#define GPIO_BTN_WAKEUP (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
||||||
GPIO_PORTA|GPIO_PIN0)
|
GPIO_PORTA|GPIO_PIN0)
|
||||||
#define GPIO_BTN_TAMPER (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
#define GPIO_BTN_TAMPER (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
||||||
GPIO_PORTC|GPIO_PIN13)
|
GPIO_PORTC|GPIO_PIN13)
|
||||||
#define GPIO_BTN_KEY (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
#define GPIO_BTN_KEY (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
||||||
GPIO_EXTI|GPIO_PORTG|GPIO_PIN8)
|
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_SEL (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
||||||
#define GPIO_JOY_DOWN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
GPIO_EXTI|GPIO_PORTG|GPIO_PIN7)
|
||||||
GPIO_EXTI|GPIO_PORTD|GPIO_PIN3)
|
#define GPIO_JOY_DOWN (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
||||||
#define GPIO_JOY_LEFT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
GPIO_EXTI|GPIO_PORTD|GPIO_PIN3)
|
||||||
GPIO_EXTI|GPIO_PORTG|GPIO_PIN14)
|
#define GPIO_JOY_LEFT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
||||||
#define GPIO_JOY_RIGHT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
GPIO_EXTI|GPIO_PORTG|GPIO_PIN14)
|
||||||
GPIO_EXTI|GPIO_PORTG|GPIO_PIN13)
|
#define GPIO_JOY_RIGHT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
||||||
#define GPIO_JOY_UP (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
GPIO_EXTI|GPIO_PORTG|GPIO_PIN13)
|
||||||
GPIO_EXTI|GPIO_PORTG|GPIO_PIN15)
|
#define GPIO_JOY_UP (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
|
||||||
|
GPIO_EXTI|GPIO_PORTG|GPIO_PIN15)
|
||||||
|
|
||||||
/* SPI FLASH chip select: PA.4 */
|
/* SPI FLASH chip select: PA.4 */
|
||||||
|
|
||||||
#define GPIO_FLASH_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
|
#define GPIO_FLASH_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
|
||||||
GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN2)
|
GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN2)
|
||||||
|
|
||||||
/* Backlight control: PA.8
|
/* Backlight control: PA.8
|
||||||
*
|
*
|
||||||
|
@ -61,8 +61,16 @@
|
|||||||
|
|
||||||
static const uint16_t g_buttons[NUM_BUTTONS] =
|
static const uint16_t g_buttons[NUM_BUTTONS] =
|
||||||
{
|
{
|
||||||
GPIO_BTN_WAKEUP, GPIO_BTN_TAMPER, GPIO_BTN_KEY, GPIO_JOY_SEL,
|
GPIO_BTN_WAKEUP, GPIO_BTN_TAMPER, GPIO_BTN_KEY,
|
||||||
GPIO_JOY_DOWN, GPIO_JOY_LEFT, GPIO_JOY_RIGHT, GPIO_JOY_UP
|
|
||||||
|
/* 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);
|
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
return oldhandler;
|
return oldhandler;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,8 +63,11 @@
|
|||||||
# error "CONFIG_ARCH_BUTTONS is not defined in the configuration"
|
# error "CONFIG_ARCH_BUTTONS is not defined in the configuration"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BUTTON_MIN 0
|
#define BUTTON_MIN 0
|
||||||
#define BUTTON_MAX 7
|
#ifdef CONFIG_DJOYSTICK
|
||||||
|
# define BUTTON_MAX 2
|
||||||
|
# define BUTTON_MAX 7
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_PM_BUTTONS_MIN
|
#ifndef CONFIG_PM_BUTTONS_MIN
|
||||||
# define CONFIG_PM_BUTTONS_MIN BUTTON_MIN
|
# define CONFIG_PM_BUTTONS_MIN BUTTON_MIN
|
||||||
@ -76,8 +79,9 @@
|
|||||||
#if CONFIG_PM_BUTTONS_MIN > CONFIG_PM_BUTTONS_MAX
|
#if CONFIG_PM_BUTTONS_MIN > CONFIG_PM_BUTTONS_MAX
|
||||||
# error "CONFIG_PM_BUTTONS_MIN > CONFIG_PM_BUTTONS_MAX"
|
# error "CONFIG_PM_BUTTONS_MIN > CONFIG_PM_BUTTONS_MAX"
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_ARCH_IRQBUTTONS
|
#ifndef CONFIG_ARCH_IRQBUTTONS
|
||||||
@ -87,6 +91,7 @@
|
|||||||
#ifndef CONFIG_PM_IRQBUTTONS_MIN
|
#ifndef CONFIG_PM_IRQBUTTONS_MIN
|
||||||
# define CONFIG_PM_IRQBUTTONS_MIN CONFIG_PM_BUTTONS_MIN
|
# define CONFIG_PM_IRQBUTTONS_MIN CONFIG_PM_BUTTONS_MIN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_PM_IRQBUTTONS_MAX
|
#ifndef CONFIG_PM_IRQBUTTONS_MAX
|
||||||
# define CONFIG_PM_IRQBUTTONS_MAX CONFIG_PM_BUTTONS_MAX
|
# define CONFIG_PM_IRQBUTTONS_MAX CONFIG_PM_BUTTONS_MAX
|
||||||
#endif
|
#endif
|
||||||
@ -94,6 +99,7 @@
|
|||||||
#if CONFIG_PM_IRQBUTTONS_MIN > CONFIG_PM_IRQBUTTONS_MAX
|
#if CONFIG_PM_IRQBUTTONS_MIN > CONFIG_PM_IRQBUTTONS_MAX
|
||||||
# error "CONFIG_PM_IRQBUTTONS_MIN > CONFIG_PM_IRQBUTTONS_MAX"
|
# error "CONFIG_PM_IRQBUTTONS_MIN > CONFIG_PM_IRQBUTTONS_MAX"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_PM_IRQBUTTONS_MAX > 7
|
#if CONFIG_PM_IRQBUTTONS_MAX > 7
|
||||||
# error "CONFIG_PM_IRQBUTTONS_MAX > 7"
|
# error "CONFIG_PM_IRQBUTTONS_MAX > 7"
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user