mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 01:42:58 +08:00
input/touchscreen: added time stamp for touchscreen event
added time stamp for touchscreen event Signed-off-by: futerigele <futerigele@xiaomi.com>
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/mm/circbuf.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef CONFIG_INPUT
|
||||
|
||||
@@ -105,13 +106,14 @@
|
||||
|
||||
struct touch_point_s
|
||||
{
|
||||
uint8_t id; /* Unique identifies contact; Same in all reports for the contact */
|
||||
uint8_t flags; /* See TOUCH_* definitions above */
|
||||
int16_t x; /* X coordinate of the touch point (uncalibrated) */
|
||||
int16_t y; /* Y coordinate of the touch point (uncalibrated) */
|
||||
int16_t h; /* Height of touch point (uncalibrated) */
|
||||
int16_t w; /* Width of touch point (uncalibrated) */
|
||||
uint16_t pressure; /* Touch pressure */
|
||||
uint8_t id; /* Unique identifies contact; Same in all reports for the contact */
|
||||
uint8_t flags; /* See TOUCH_* definitions above */
|
||||
int16_t x; /* X coordinate of the touch point (uncalibrated) */
|
||||
int16_t y; /* Y coordinate of the touch point (uncalibrated) */
|
||||
int16_t h; /* Height of touch point (uncalibrated) */
|
||||
int16_t w; /* Width of touch point (uncalibrated) */
|
||||
uint16_t pressure; /* Touch pressure */
|
||||
uint64_t timestamp; /* Touch event time stamp, in microseconds */
|
||||
};
|
||||
|
||||
/* The typical touchscreen driver is a read-only, input character device
|
||||
@@ -164,6 +166,22 @@ struct touch_lowerhalf_s
|
||||
int cmd, unsigned long arg);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint64_t touch_get_time(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
|
||||
#ifdef CONFIG_CLOCK_MONOTONIC
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
#else
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
#endif
|
||||
return 1000000ull * ts.tv_sec + ts.tv_nsec / 1000;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user