mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 22:20:01 +08:00
input: change wd timer to precoss input device event
used wdt threads process event Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
This commit is contained in:
@@ -519,6 +519,13 @@ endchoice
|
||||
endif # SIM_X11FB
|
||||
|
||||
if INPUT
|
||||
config SIM_X11EVENT_INTERVAL
|
||||
int "X11 event interval in ms"
|
||||
default 8
|
||||
depends on SIM_X11FB
|
||||
---help---
|
||||
X11 event sleep time
|
||||
|
||||
choice
|
||||
prompt "Input Device"
|
||||
default SIM_NOINPUT
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
# define AJOY_SUPPORTED (AJOY_BUTTON_1_BIT | AJOY_BUTTON_2_BIT | \
|
||||
AJOY_BUTTON_3_BIT)
|
||||
#define AJOY_SUPPORTED (AJOY_BUTTON_1_BIT | AJOY_BUTTON_2_BIT | \
|
||||
AJOY_BUTTON_3_BIT)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
|
||||
@@ -39,6 +39,21 @@
|
||||
#include "sim_internal.h"
|
||||
#include "sim_hostusrsock.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define SIM_X11EVENT_PERIOD MSEC2TICK(CONFIG_SIM_X11EVENT_INTERVAL)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SIM_TOUCHSCREEN) || defined(CONFIG_SIM_AJOYSTICK) || \
|
||||
defined(CONFIG_SIM_BUTTONS)
|
||||
static struct wdog_s g_x11event_wdog; /* Watchdog for event loop */
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@@ -59,6 +74,24 @@ static void sim_init_cmdline(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_x11event_interrupt
|
||||
*
|
||||
* Description:
|
||||
* interrupts event process function
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SIM_TOUCHSCREEN) || defined(CONFIG_SIM_AJOYSTICK) || \
|
||||
defined(CONFIG_SIM_BUTTONS)
|
||||
static void sim_x11event_interrupt(wdparm_t arg)
|
||||
{
|
||||
sim_x11events();
|
||||
wd_start_next((FAR struct wdog_s *)arg, SIM_X11EVENT_PERIOD,
|
||||
sim_x11event_interrupt, arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_init_smartfs
|
||||
*
|
||||
@@ -169,13 +202,6 @@ static int sim_loop_task(int argc, char **argv)
|
||||
|
||||
sched_lock();
|
||||
|
||||
#if defined(CONFIG_SIM_TOUCHSCREEN) || defined(CONFIG_SIM_AJOYSTICK) || \
|
||||
defined(CONFIG_SIM_BUTTONS)
|
||||
/* Drive the X11 event loop */
|
||||
|
||||
sim_x11events();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SIM_LCDDRIVER) || defined(CONFIG_SIM_FRAMEBUFFER)
|
||||
sim_x11loop();
|
||||
#endif
|
||||
@@ -323,6 +349,12 @@ void up_initialize(void)
|
||||
sim_encoder_initialize();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SIM_TOUCHSCREEN) || defined(CONFIG_SIM_AJOYSTICK) || \
|
||||
defined(CONFIG_SIM_BUTTONS)
|
||||
wd_start(&g_x11event_wdog, 0, sim_x11event_interrupt,
|
||||
(wdparm_t)&g_x11event_wdog);
|
||||
#endif
|
||||
|
||||
kthread_create("loop_task", CONFIG_SIM_LOOPTASK_PRIORITY,
|
||||
CONFIG_DEFAULT_TASK_STACKSIZE,
|
||||
sim_loop_task, NULL);
|
||||
|
||||
Reference in New Issue
Block a user