summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/eve_touch.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-03-23 21:33:57 +0100
committerUros Majstorovic <majstor@majstor.org>2021-03-23 21:33:57 +0100
commit8c61343677d2ed8f929372863016524707b8ab93 (patch)
tree59f2c65f006bcf20c0b9a6a73c53a100d08775a2 /fw/fe310/eos/eve/eve_touch.c
parent98941cdc89d93f5387bb98a443f06408321acc8f (diff)
form scroll completed
Diffstat (limited to 'fw/fe310/eos/eve/eve_touch.c')
-rw-r--r--fw/fe310/eos/eve/eve_touch.c272
1 files changed, 152 insertions, 120 deletions
diff --git a/fw/fe310/eos/eve/eve_touch.c b/fw/fe310/eos/eve/eve_touch.c
index 334dfa3..b5ca7fd 100644
--- a/fw/fe310/eos/eve/eve_touch.c
+++ b/fw/fe310/eos/eve/eve_touch.c
@@ -4,14 +4,6 @@
#include "eve.h"
-#define EVE_THRESHOLD_X 5
-#define EVE_THRESHOLD_Y 5
-#define EVE_TRAVG 3
-
-#define EVE_NOTOUCH 0x80000000
-
-#define EVE_MAX_TOUCH 5
-
static int _intr_mask = EVE_INT_TAG | EVE_INT_TOUCH;
static int _multitouch;
static uint8_t _tag0;
@@ -50,7 +42,6 @@ void eve_handle_touch(void) {
int i;
char touch_ex = 0;
char int_ccomplete = 0;
- uint8_t touch_last = 0;
uint8_t flags;
eve_spi_start();
@@ -61,44 +52,54 @@ void eve_handle_touch(void) {
uint8_t touch_tag;
uint32_t touch_xy;
uint64_t now = 0;
+ uint16_t touch_evt = 0;
EVETouch *touch = &_touch[i];
- touch->evt = 0;
touch_xy = i < 4 ? eve_read32(_reg_touch[i]) : (((uint32_t)eve_read16(REG_CTOUCH_TOUCH4_X) << 16) | eve_read16(REG_CTOUCH_TOUCH4_Y));
- if (touch_xy != 0x80008000) {
+ if (touch_xy != EVE_NOTOUCH) {
int16_t touch_x = touch_xy >> 16;
int16_t touch_y = touch_xy & 0xffff;
now = eve_time_get_tick();
- if (touch->x == EVE_NOTOUCH) {
+ if (touch->eevt & EVE_TOUCH_EETYPE_NOTOUCH) {
uint16_t _evt = 0;
uint16_t _eevt = 0;
- uint16_t _ttevt = eve_touch_timer_evt(i);
+ uint16_t _ttevt = eve_touch_timer_get_evt(touch);
if (_ttevt) {
- EVEVTrack *vtrack = eve_vtrack_get();
+ touch->eevt &= ~EVE_TOUCH_EETYPE_NOTOUCH;
- if (_ttevt & EVE_TOUCH_ETYPE_TAP1) {
+ if (_ttevt & EVE_TOUCH_ETYPE_TAP2) {
int dx = touch_x - touch->x0;
int dy = touch_y - touch->y0;
+
dx = dx < 0 ? -dx : dx;
dy = dy < 0 ? -dy : dy;
- if ((dx > EVE_THRESHOLD_X) || (dy > EVE_THRESHOLD_Y)) {
- touch->evt |= EVE_TOUCH_ETYPE_TAP1;
+ if ((dx > EVE_TOUCH_THRESHOLD_X) || (dy > EVE_TOUCH_THRESHOLD_Y)) {
+ touch_evt |= EVE_TOUCH_ETYPE_TAP1;
} else {
_evt |= EVE_TOUCH_ETYPE_TAP2;
_eevt |= EVE_TOUCH_EETYPE_TAP2;
}
- } else {
- touch->evt |= _ttevt;
+ }
+ if (_ttevt & EVE_TOUCH_ETYPE_TRACK) {
+ EVEVTrack *vtrack = eve_vtrack_get();
+
+ _eevt |= EVE_TOUCH_EETYPE_TRACK_ABORT;
+ touch_evt |= (EVE_TOUCH_ETYPE_TRACK_STOP | EVE_TOUCH_ETYPE_TRACK_ABORT);
if (vtrack->stop) vtrack->stop(touch, vtrack->param);
}
- if (_touch_handler && touch->evt) {
- _touch_handler(_touch_handler_param, _touch_timer.tag0, i);
+ if (_ttevt & EVE_TOUCH_ETYPE_TIMER) {
+ _eevt |= EVE_TOUCH_EETYPE_TIMER_ABORT;
+ touch_evt |= EVE_TOUCH_ETYPE_TIMER_ABORT;
+ }
+
+ eve_touch_timer_clear(touch);
+ if (_touch_handler && touch_evt) {
+ _touch_handler(_touch_timer.touch, touch_evt, _touch_timer.tag0, _touch_handler_param);
}
- eve_touch_timer_clear();
}
- touch->evt = EVE_TOUCH_ETYPE_POINT | _evt;
+ touch_evt = EVE_TOUCH_ETYPE_POINT | _evt;
touch->eevt = _eevt;
touch->tag0 = 0;
touch->tag = 0;
@@ -115,8 +116,8 @@ void eve_handle_touch(void) {
int dt = now - touch->t;
int vx = ((int)touch_x - touch->x) * (int)(EVE_RTC_FREQ) / dt;
int vy = ((int)touch_y - touch->y) * (int)(EVE_RTC_FREQ) / dt;
- touch->vx = touch->vx ? (vx + touch->vx * EVE_TRAVG) / (EVE_TRAVG + 1) : vx;
- touch->vy = touch->vy ? (vy + touch->vy * EVE_TRAVG) / (EVE_TRAVG + 1) : vy;
+ touch->vx = touch->vx ? (vx + touch->vx * EVE_TOUCH_TRAVG) / (EVE_TOUCH_TRAVG + 1) : vx;
+ touch->vy = touch->vy ? (vy + touch->vy * EVE_TOUCH_TRAVG) / (EVE_TOUCH_TRAVG + 1) : vy;
touch->t = now;
}
touch->x = touch_x;
@@ -129,27 +130,27 @@ void eve_handle_touch(void) {
touch_ex = 1;
} else {
touch_tag = 0;
- if (touch->x != EVE_NOTOUCH) {
- touch->evt |= EVE_TOUCH_ETYPE_POINT_UP;
- if (eve_touch_timer_evt(i)) {
- _touch_timer.evt &= ~EVE_TOUCH_ETYPE_LPRESS;
- if (!_touch_timer.evt) eve_touch_timer_clear();
+ if (!(touch->eevt & EVE_TOUCH_EETYPE_NOTOUCH)) {
+ uint16_t _ttevt = eve_touch_timer_get_evt(touch);
+
+ touch_evt = EVE_TOUCH_ETYPE_POINT_UP;
+ touch->eevt |= EVE_TOUCH_EETYPE_NOTOUCH;
+ if (_ttevt & EVE_TOUCH_ETYPE_LPRESS) {
+ eve_touch_timer_set_evt(touch, _ttevt & ~EVE_TOUCH_ETYPE_LPRESS);
}
if (touch->tracker.tag && touch->tracker.track) {
uint8_t opt = _tag_opt[touch->tracker.tag];
char track_ext = ((opt & EVE_TOUCH_OPT_TRACK_EXT_X) && (touch->eevt & EVE_TOUCH_EETYPE_TRACK_X)) ||
((opt & EVE_TOUCH_OPT_TRACK_EXT_Y) && (touch->eevt & EVE_TOUCH_EETYPE_TRACK_Y));
- if (!_touch_timer.evt && track_ext) {
+ if (!eve_touch_timer_get_evt(NULL) && track_ext) {
EVEVTrack *vtrack = eve_vtrack_get();
- eve_touch_timer_set(_tag0, i, EVE_TOUCH_ETYPE_TRACK, EVE_TOUCH_TIMEOUT_TRACK);
+ eve_touch_timer_set(touch, EVE_TOUCH_ETYPE_TRACK, _tag0, EVE_TOUCH_TIMEOUT_TRACK);
if (vtrack->start) vtrack->start(touch, vtrack->param);
} else {
- touch->evt |= EVE_TOUCH_ETYPE_TRACK_STOP;
+ touch_evt |= EVE_TOUCH_ETYPE_TRACK_STOP;
}
}
- touch->x = EVE_NOTOUCH;
- touch->y = EVE_NOTOUCH;
}
}
if (touch_tag != touch->tag) {
@@ -157,83 +158,79 @@ void eve_handle_touch(void) {
if (!_tag0) _tag0 = touch_tag;
if (!touch->tag0) {
touch->tag0 = touch_tag;
- if (_tag_opt[touch_tag] & EVE_TOUCH_OPT_TRACK_MASK) {
+ if (_tag_opt[touch_tag] & (EVE_TOUCH_OPT_TRACK | EVE_TOUCH_OPT_TRACK_REG)) {
touch->tracker.tag = touch_tag;
}
if (touch->tracker.tag && !(_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_XY)) {
+ touch_evt |= EVE_TOUCH_ETYPE_TRACK_START;
touch->tracker.track = 1;
- touch->evt |= EVE_TOUCH_ETYPE_TRACK_START;
touch->t = now;
}
- if (!_touch_timer.evt && (_tag_opt[touch_tag] & EVE_TOUCH_OPT_TIMER_MASK)) {
+ if (!eve_touch_timer_get_evt(NULL) && (_tag_opt[touch_tag] & (EVE_TOUCH_OPT_LPRESS | EVE_TOUCH_OPT_TAP2))) {
uint16_t _evt = 0;
if (_tag_opt[touch_tag] & EVE_TOUCH_OPT_LPRESS) _evt |= EVE_TOUCH_ETYPE_LPRESS;
- if (_tag_opt[touch_tag] & EVE_TOUCH_OPT_DTAP) _evt |= EVE_TOUCH_ETYPE_TAP1;
- eve_touch_timer_set(_tag0, i, _evt, EVE_TOUCH_TIMEOUT_TAP);
+ if (_tag_opt[touch_tag] & EVE_TOUCH_OPT_TAP2) _evt |= EVE_TOUCH_ETYPE_TAP2;
+ eve_touch_timer_set(touch, _evt, _tag0, EVE_TOUCH_TIMEOUT_TAP);
}
}
}
touch->tag_up = touch->tag;
- if (touch->tag_up) touch->evt |= EVE_TOUCH_ETYPE_TAG_UP;
+ if (touch->tag_up) touch_evt |= EVE_TOUCH_ETYPE_TAG_UP;
touch->tag = touch_tag;
- if (touch->tag) touch->evt |= EVE_TOUCH_ETYPE_TAG;
+ if (touch->tag) touch_evt |= EVE_TOUCH_ETYPE_TAG;
}
- if (touch_xy != 0x80008000) {
+ if (touch_xy != EVE_NOTOUCH) {
+ uint16_t _ttevt = eve_touch_timer_get_evt(touch);
int _track = touch->tracker.tag && !touch->tracker.track;
- int _timer = eve_touch_timer_evt(i) & EVE_TOUCH_ETYPE_TIMER_MASK;
+ int _timer = _ttevt & (EVE_TOUCH_ETYPE_LPRESS | EVE_TOUCH_ETYPE_TAP2);
if (_track || _timer) {
int dx = touch->x - touch->x0;
int dy = touch->y - touch->y0;
dx = dx < 0 ? -dx : dx;
dy = dy < 0 ? -dy : dy;
if (_track) {
- if ((dx > EVE_THRESHOLD_X) && !(_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_X)) {
+ if ((dx > EVE_TOUCH_THRESHOLD_X) && !(_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_X)) {
touch->tracker.tag = 0;
}
- if ((dy > EVE_THRESHOLD_Y) && !(_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_Y)) {
+ if ((dy > EVE_TOUCH_THRESHOLD_Y) && !(_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_Y)) {
touch->tracker.tag = 0;
}
- if (touch->tracker.tag && ((dx > EVE_THRESHOLD_X) || (dy > EVE_THRESHOLD_Y))) {
- if (dx > EVE_THRESHOLD_X) {
+ if (touch->tracker.tag && ((dx > EVE_TOUCH_THRESHOLD_X) || (dy > EVE_TOUCH_THRESHOLD_Y))) {
+ if (dx > EVE_TOUCH_THRESHOLD_X) {
touch->eevt |= touch->x > touch->x0 ? EVE_TOUCH_EETYPE_TRACK_RIGHT : EVE_TOUCH_EETYPE_TRACK_LEFT;
}
- if (dy > EVE_THRESHOLD_Y) {
+ if (dy > EVE_TOUCH_THRESHOLD_Y) {
touch->eevt |= touch->y > touch->y0 ? EVE_TOUCH_EETYPE_TRACK_DOWN : EVE_TOUCH_EETYPE_TRACK_UP;
}
+ touch_evt |= EVE_TOUCH_ETYPE_TRACK_START;
touch->tracker.track = 1;
- touch->evt |= EVE_TOUCH_ETYPE_TRACK_START;
touch->t = now;
}
}
- if (_timer && ((dx > EVE_THRESHOLD_X) || (dy > EVE_THRESHOLD_Y))) {
+ if (_timer && ((dx > EVE_TOUCH_THRESHOLD_X) || (dy > EVE_TOUCH_THRESHOLD_Y))) {
+ eve_touch_timer_set_evt(touch, _ttevt & ~(EVE_TOUCH_ETYPE_LPRESS | EVE_TOUCH_ETYPE_TAP2));
_timer = 0;
- _touch_timer.evt &= ~EVE_TOUCH_ETYPE_TIMER_MASK;
- if (!_touch_timer.evt) eve_touch_timer_clear();
}
}
if (touch->tracker.tag && touch->tracker.track) {
- touch->evt |= _tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_MASK;
+ if (_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK) touch_evt |= EVE_TOUCH_ETYPE_TRACK;
+ if (_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_REG) touch_evt |= EVE_TOUCH_ETYPE_TRACK_REG;
}
- if (touch->evt & EVE_TOUCH_ETYPE_TRACK_REG) {
+ if (touch_evt & EVE_TOUCH_ETYPE_TRACK_REG) {
uint32_t touch_track = eve_read32(_reg_track[i]);
if (touch->tracker.tag == (touch_track & 0xff)) {
touch->tracker.val = touch_track >> 16;
} else {
- touch->evt &= ~EVE_TOUCH_ETYPE_TRACK_REG;
+ touch_evt &= ~EVE_TOUCH_ETYPE_TRACK_REG;
}
}
if (touch->tracker.tag || _timer) int_ccomplete = 1;
}
- if (touch->evt) touch_last = i + 1;
- if (!_multitouch) break;
- }
-
- for (i=0; i<touch_last; i++) {
- EVETouch *touch = &_touch[i];
- if (_touch_handler && touch->evt) {
- _touch_handler(_touch_handler_param, _tag0, i);
+ if (_touch_handler && touch_evt) {
+ _touch_handler(touch, touch_evt, _tag0, _touch_handler_param);
}
+ if (!_multitouch) break;
}
if (!touch_ex) {
@@ -256,41 +253,51 @@ void eve_handle_touch(void) {
}
void eve_handle_time(void) {
- EVETouch *touch = &_touch[_touch_timer.idx];
-
- if ((_touch_timer.evt & EVE_TOUCH_ETYPE_TAP1) && (touch->x != EVE_NOTOUCH)) _touch_timer.evt &= ~EVE_TOUCH_ETYPE_TAP1;
+ EVETouch *touch = _touch_timer.touch;
if (_touch_timer.evt) {
int more = 0;
- int _x = touch->x;
- int _y = touch->y;
- EVEVTrack *vtrack = eve_vtrack_get();
+ uint16_t touch_evt = 0;
eve_spi_start();
- touch->evt = _touch_timer.evt;
- if (touch->evt & EVE_TOUCH_ETYPE_LPRESS) {
- touch->eevt |= EVE_TOUCH_EETYPE_LPRESS;
- } else {
- if (vtrack->tick) more = vtrack->tick(touch, vtrack->param);
- if (more) {
- eve_timer_set(EVE_TOUCH_TIMEOUT_TRACK);
- } else if (vtrack->stop) {
- vtrack->stop(touch, vtrack->param);
+ if (_touch_timer.evt & EVE_TOUCH_ETYPE_LPRESS) {
+ touch_evt |= EVE_TOUCH_ETYPE_LPRESS;
+ if (touch) touch->eevt |= EVE_TOUCH_EETYPE_LPRESS;
+ }
+ if (_touch_timer.evt & EVE_TOUCH_ETYPE_TAP2) {
+ touch_evt |= EVE_TOUCH_ETYPE_TAP1;
+ if (touch) touch->eevt |= EVE_TOUCH_EETYPE_TAP1;
+ }
+ if (_touch_timer.evt & EVE_TOUCH_ETYPE_TRACK) {
+ EVEVTrack *vtrack = eve_vtrack_get();
+
+ if (vtrack->tick) {
+ touch_evt |= EVE_TOUCH_ETYPE_TRACK;
+ more = vtrack->tick(touch, vtrack->param);
}
+ if (!more) {
+ touch_evt |= EVE_TOUCH_ETYPE_TRACK_STOP;
+ if (vtrack->stop) vtrack->stop(touch, vtrack->param);
+ }
+ }
+ if (_touch_timer.evt & EVE_TOUCH_ETYPE_TIMER) {
+ touch_evt |= EVE_TOUCH_ETYPE_TIMER;
+ more = 1;
}
- if (_touch_handler) _touch_handler(_touch_handler_param, _touch_timer.tag0, _touch_timer.idx);
+ if (more) {
+ eve_timer_set(_touch_timer.to);
+ } else {
+ _touch_timer.evt = 0;
+ }
- eve_spi_stop();
+ if (_touch_handler && touch_evt) {
+ _touch_handler(touch, touch_evt, _touch_timer.tag0, _touch_handler_param);
+ }
- if (!more) eve_touch_timer_clear();
- touch->x = _x;
- touch->y = _y;
- } else {
- eve_touch_timer_clear();
+ eve_spi_stop();
}
-
}
void eve_touch_init(void) {
@@ -300,9 +307,9 @@ void eve_touch_init(void) {
for (i=0; i<EVE_MAX_TOUCH; i++) {
EVETouch *touch = &_touch[i];
- touch->x = EVE_NOTOUCH;
- touch->y = EVE_NOTOUCH;
+ touch->eevt |= EVE_TOUCH_EETYPE_NOTOUCH;
}
+
eve_write8(REG_INT_MASK, _intr_mask);
eve_write8(REG_INT_EN, 0x01);
while(eve_read8(REG_INT_FLAGS));
@@ -317,42 +324,43 @@ EVETouch *eve_touch_get(int i) {
return &_touch[i];
}
-EVETouch *eve_touch_evt(uint8_t tag0, int touch_idx, uint8_t tag_min, uint8_t tag_n, uint16_t *evt) {
+int8_t eve_touch_get_idx(EVETouch *touch) {
+ if (touch == NULL) return -1;
+ return touch - _touch;
+}
+
+uint16_t eve_touch_evt(EVETouch *touch, uint16_t evt, uint8_t tag0, uint8_t tag_min, uint8_t tag_n) {
int tag_max;
uint8_t _tag;
uint16_t _evt;
- EVETouch *ret = NULL;
- *evt = 0;
-
- if ((touch_idx < 0) || (touch_idx > 4)) return ret;
- if (tag_min == EVE_TAG_NOTAG) return ret;
+ if (tag_min == EVE_TAG_NOTAG) return 0;
tag_max = tag_min + tag_n;
- if ((tag0 < tag_min) || (tag0 >= tag_max)) return ret;
+ if ((tag0 < tag_min) || (tag0 >= tag_max)) return 0;
- ret = &_touch[touch_idx];
- _evt = ret->evt;
+ _evt = evt & (EVE_TOUCH_ETYPE_TIMER_MASK | EVE_TOUCH_ETYPE_USR_MASK);
+ if (touch == NULL) return _evt;
- *evt |= _evt & EVE_TOUCH_ETYPE_POINT_MASK;
- if (_evt & EVE_TOUCH_ETYPE_TAG) {
- _tag = ret->tag;
- if ((_tag >= tag_min) && (_tag < tag_max)) *evt |= EVE_TOUCH_ETYPE_TAG;
+ _evt |= evt & EVE_TOUCH_ETYPE_POINT_MASK;
+ if (evt & EVE_TOUCH_ETYPE_TAG) {
+ _tag = touch->tag;
+ if ((_tag >= tag_min) && (_tag < tag_max)) _evt |= EVE_TOUCH_ETYPE_TAG;
}
- if (_evt & EVE_TOUCH_ETYPE_TAG_UP) {
- _tag = ret->tag_up;
- if ((_tag >= tag_min) && (_tag < tag_max)) *evt |= EVE_TOUCH_ETYPE_TAG_UP;
+ if (evt & EVE_TOUCH_ETYPE_TAG_UP) {
+ _tag = touch->tag_up;
+ if ((_tag >= tag_min) && (_tag < tag_max)) _evt |= EVE_TOUCH_ETYPE_TAG_UP;
}
- if (_evt & EVE_TOUCH_ETYPE_TRACK_MASK) {
- _tag = ret->tracker.tag;
- if ((_tag >= tag_min) && (_tag < tag_max)) *evt |= _evt & EVE_TOUCH_ETYPE_TRACK_MASK;
+ if (evt & EVE_TOUCH_ETYPE_TRACK_MASK) {
+ _tag = touch->tracker.tag;
+ if ((_tag >= tag_min) && (_tag < tag_max)) _evt |= evt & EVE_TOUCH_ETYPE_TRACK_MASK;
}
- if (_evt & (EVE_TOUCH_ETYPE_LPRESS | EVE_TOUCH_ETYPE_TAP1 | EVE_TOUCH_ETYPE_TAP2)) {
- _tag = ret->tag0;
- if ((_tag >= tag_min) && (_tag < tag_max)) *evt |= _evt & (EVE_TOUCH_ETYPE_LPRESS | EVE_TOUCH_ETYPE_TAP1 | EVE_TOUCH_ETYPE_TAP2);
+ if (evt & (EVE_TOUCH_ETYPE_LPRESS | EVE_TOUCH_ETYPE_TAP1 | EVE_TOUCH_ETYPE_TAP2)) {
+ _tag = touch->tag0;
+ if ((_tag >= tag_min) && (_tag < tag_max)) _evt |= evt & (EVE_TOUCH_ETYPE_LPRESS | EVE_TOUCH_ETYPE_TAP1 | EVE_TOUCH_ETYPE_TAP2);
}
- return ret;
+ return _evt;
}
void eve_touch_set_opt(uint8_t tag, uint8_t opt) {
@@ -367,20 +375,44 @@ void eve_touch_clear_opt(void) {
memset(_tag_opt, 0, sizeof(_tag_opt));
}
-void eve_touch_timer_set(uint8_t tag0, int i, uint16_t evt, uint32_t to) {
- _touch_timer.tag0 = tag0;
- _touch_timer.idx = i;
+void eve_touch_timer_set(EVETouch *touch, uint16_t evt, uint8_t tag0, uint32_t to) {
+ _touch_timer.touch = touch;
_touch_timer.evt = evt;
+ _touch_timer.tag0 = tag0;
+ _touch_timer.to = to;
eve_timer_set(to);
}
-void eve_touch_timer_clear(void) {
- eve_timer_clear();
- _touch_timer.evt = 0;
+void eve_touch_timer_clear(EVETouch *touch) {
+ eve_touch_timer_set_evt(touch, 0);
+}
+
+uint16_t eve_touch_timer_get_evt(EVETouch *touch) {
+ uint16_t ret = 0;
+
+ if ((touch == NULL) || (_touch_timer.touch == touch)) {
+ ret = _touch_timer.evt;
+ } else if (_touch_timer.touch == NULL) {
+ ret = _touch_timer.evt & EVE_TOUCH_ETYPE_TIMER;
+ }
+ return ret;
+}
+
+void eve_touch_timer_set_evt(EVETouch *touch, uint16_t evt) {
+ if (touch == _touch_timer.touch) {
+ _touch_timer.evt = evt;
+ } else if (_touch_timer.touch == NULL) {
+ _touch_timer.evt = evt & EVE_TOUCH_ETYPE_TIMER;
+ }
+ if (!_touch_timer.evt) eve_timer_clear();
+}
+
+void eve_touch_timer_start(uint8_t tag0, uint32_t to) {
+ eve_touch_timer_set(NULL, EVE_TOUCH_ETYPE_TIMER, tag0, to);
}
-uint16_t eve_touch_timer_evt(int i) {
- return (i == _touch_timer.idx) ? _touch_timer.evt : 0;
+void eve_touch_timer_stop(void) {
+ eve_touch_timer_clear(NULL);
}
EVETouchTimer *eve_touch_timer_get(void) {