6#include "roo_logging.h"
13template <
int max_touch_po
ints>
54 return TouchResult(detection_timestamp_, points_touched_);
58 roo_time::Uptime detection_timestamp_;
63template <
int max_touch_po
ints>
66 roo_time::Uptime
now = roo_time::Uptime::Now();
67 roo_time::Duration
dt =
now - detection_timestamp_;
68 if (
dt < roo_time::Millis(config_.min_sampling_interval_ms)) {
77 if (
dt < roo_time::Millis(config_.touch_intertia_ms)) {
84 detection_timestamp_ =
now;
92 float alpha = 1 -
pow(config_.smoothing_factor,
dt.inMicros() / 10000.0);
98 for (
int j = 0;
j < points_touched_; ++
j) {
99 if (touch_points_[
j].
id ==
p.id) {
105 if (
dt > roo_time::Micros(0)) {
107 p.vx = 1000000LL * (x -
prev.x) /
dt.inMicros();
108 p.vy = 1000000LL * (y -
prev.y) /
dt.inMicros();
118 detection_timestamp_ =
now;
virtual int readTouch(TouchPoint *points)=0
TouchResult getTouch(TouchPoint *points, int max_points) override
Read the current touch state.
BasicTouchDevice(Config config)
virtual ~BasicTouchDevice()=default
Touch controller interface.
Defines 140 opaque HTML named colors.
int min_sampling_interval_ms
A single touch point returned by a touch controller.
Metadata for a touch sampling result.