From 3050565531af2b3a09f2213893f10c64cf9fe43f Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Wed, 24 Feb 2021 19:50:20 +0100 Subject: added test app with voice, wifi/cellular data connectivity examples --- fw/fe310/eos/eve/eve_kbd.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'fw/fe310/eos/eve/eve_kbd.c') diff --git a/fw/fe310/eos/eve/eve_kbd.c b/fw/fe310/eos/eve/eve_kbd.c index 99210ce..5dd4d5a 100644 --- a/fw/fe310/eos/eve/eve_kbd.c +++ b/fw/fe310/eos/eve/eve_kbd.c @@ -38,24 +38,36 @@ void eve_kbd_init(EVEKbd *kbd, EVERect *g, uint32_t mem_addr, uint32_t *mem_next } kbd->mem_addr = mem_addr; kbd->key_modifier = 0; + kbd->key_modifier_sticky = 0; + kbd->key_modifier_lock = 0; kbd->key_count = 0; kbd->key_down = 0; kbd->putc = NULL; kbd->param = NULL; - kbd->active = 1; + kbd->key_down = 0xff; eve_write16(REG_CMD_DL, 0); eve_kbd_draw(kbd); eve_cmd_exec(1); mem_size = eve_read16(REG_CMD_DL); eve_cmd(CMD_MEMCPY, "www", mem_addr, EVE_RAM_DL, mem_size); eve_cmd_exec(1); - kbd->active = 0; + kbd->key_down = 0; kbd->mem_size = mem_size; *mem_next = kbd->mem_addr + kbd->mem_size; } +void eve_kbd_close(EVEKbd *kbd) { + kbd->key_modifier = 0; + kbd->key_modifier_sticky = 0; + kbd->key_modifier_lock = 0; + kbd->key_count = 0; + kbd->key_down = 0; + kbd->putc = NULL; + kbd->param = NULL; +} + void eve_kbd_set_handler(EVEKbd *kbd, eve_kbd_input_handler_t putc, void *param) { kbd->putc = putc; kbd->param = param; @@ -64,9 +76,12 @@ void eve_kbd_set_handler(EVEKbd *kbd, eve_kbd_input_handler_t putc, void *param) int eve_kbd_touch(EVEKbd *kbd, uint8_t tag0, int touch_idx) { EVETouch *t; uint16_t evt; + int ret; t = eve_touch_evt(tag0, touch_idx, 1, 126, &evt); if (t && evt) { + ret = 1; + if (evt & EVE_TOUCH_ETYPE_TAG) { uint8_t _tag = t->tag; @@ -117,16 +132,15 @@ int eve_kbd_touch(EVEKbd *kbd, uint8_t tag0, int touch_idx) { } } } - kbd->active = 1; } else { - kbd->active = 0; + ret = 0; } - return kbd->active; + return ret; } uint8_t eve_kbd_draw(EVEKbd *kbd) { - if (kbd->active) { + if (kbd->key_down || kbd->key_modifier) { int x = kbd->g.x; int y = kbd->g.y; int w = kbd->g.w; -- cgit v1.2.3