summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/eve_kbd.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-02-24 19:50:20 +0100
committerUros Majstorovic <majstor@majstor.org>2021-02-24 19:50:20 +0100
commit3050565531af2b3a09f2213893f10c64cf9fe43f (patch)
tree689d10ca064dba4480a85b6ec14a4eb8305d5c89 /fw/fe310/eos/eve/eve_kbd.c
parentd0a0fee0571be63f023f8f6a49a0b76b89871e56 (diff)
added test app with voice, wifi/cellular data connectivity examples
Diffstat (limited to 'fw/fe310/eos/eve/eve_kbd.c')
-rw-r--r--fw/fe310/eos/eve/eve_kbd.c26
1 files changed, 20 insertions, 6 deletions
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;