From 8592a98072740de43a5b469f60854d805641c999 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sat, 7 Mar 2020 05:15:17 +0100 Subject: eve screen/tile/canvas/page/form fw added; page widget added --- code/fe310/eos/eve/eve.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'code/fe310/eos/eve/eve.c') diff --git a/code/fe310/eos/eve/eve.c b/code/fe310/eos/eve/eve.c index 4677dc0..adfe5f9 100644 --- a/code/fe310/eos/eve/eve.c +++ b/code/fe310/eos/eve/eve.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -168,28 +169,28 @@ static void _cmd_end(void) { } static void _cmd_string(const char *s, uint8_t flags) { - int i = 0, p = 0; + int i = 0; while (s[i] != 0) { - eve_spi_xchg8(s[i], EVE_SPI_FLAG_BSWAP | flags); + eve_spi_xchg8(s[i], flags); i++; } - eve_spi_xchg8(0, EVE_SPI_FLAG_BSWAP | flags); + eve_spi_xchg8(0, flags); i++; _cmd_inc(i); } static void _cmd_buffer(const char *b, int size, uint8_t flags) { - int i = 0, p = 0; + int i = 0; for (i=0; i 0) { - eve_spi_xchg8(0, EVE_SPI_FLAG_BSWAP | flags); + eve_spi_xchg8(0, flags); i--; } } _cmd_end(); - va_end(argv); } uint32_t eve_cmd_result(uint16_t offset) { @@ -403,7 +404,7 @@ void eve_handle_touch(void) { if (touch->tracker.tag && !(_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_XY)) { touch->tracker.track = 1; touch->evt |= EVE_TOUCH_ETYPE_TRACK_START; - if (!touch->t && (_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_INERT)) touch->t = now; + touch->t = now; } if (!_tag0 && ((_tag_opt[touch_tag] | _tag_opt[EVE_TAG_SCREEN]) & EVE_TOUCH_OPT_TIMER_MASK)) { _touch_timer.tag = _tag_opt[touch_tag] & EVE_TOUCH_OPT_TIMER_MASK ? touch_tag : EVE_TAG_SCREEN; @@ -444,7 +445,7 @@ void eve_handle_touch(void) { } touch->tracker.track = 1; touch->evt |= EVE_TOUCH_ETYPE_TRACK_START; - if (!touch->t && (_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_INERT)) touch->t = now; + touch->t = now; } } if (_touch_timer.tag && ((dx > EVE_THRESHOLD_X) || (dy > EVE_THRESHOLD_Y))) { @@ -653,6 +654,7 @@ EVETouch *eve_touch_evt(uint8_t tag0, int touch_idx, uint8_t tag_min, uint8_t ta *evt = 0; if ((touch_idx < 0) || (touch_idx > 4)) return ret; + if ((tag_min == 0) || (tag_max == 0)) return ret; if ((tag0 < tag_min) || (tag0 > tag_max)) return ret; ret = &_touch[touch_idx]; @@ -667,6 +669,10 @@ EVETouch *eve_touch_evt(uint8_t tag0, int touch_idx, uint8_t tag_min, uint8_t ta _tag = ret->tag_up; if ((_tag >= tag_min) && (_tag <= tag_max)) *evt |= EVE_TOUCH_ETYPE_TAG_UP; } + if (_evt & EVE_TOUCH_ETYPE_TRACK_REG) { + _tag = ret->tracker.tag; + if ((_tag >= tag_min) && (_tag <= tag_max)) *evt |= EVE_TOUCH_ETYPE_TRACK_REG; + } 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 | EVE_TOUCH_ETYPE_TRACK_XY); @@ -683,6 +689,14 @@ void eve_touch_set_opt(uint8_t tag, uint8_t opt) { _tag_opt[tag] = opt; } +uint8_t eve_touch_get_opt(uint8_t tag) { + return _tag_opt[tag]; +} + +void eve_touch_clear_opt(void) { + memset(_tag_opt, 0, sizeof(_tag_opt)); +} + EVETouchTimer *eve_touch_get_timer(void) { return &_touch_timer; } -- cgit v1.2.3