diff options
author | Uros Majstorovic <majstor@majstor.org> | 2022-09-04 18:37:42 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2022-09-04 18:37:42 +0200 |
commit | fc98d3809e0db36d634f290417b9152f87f83e3e (patch) | |
tree | d7c0cbb883571dccfcd4028d8b7b2a2144fc2d2b /fw/fe310/phone/app/status.c | |
parent | 07e6abe5d5a1813298805bea2bf9d62ad895aaaa (diff) |
new phone firmware
Diffstat (limited to 'fw/fe310/phone/app/status.c')
-rw-r--r-- | fw/fe310/phone/app/status.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/fw/fe310/phone/app/status.c b/fw/fe310/phone/app/status.c new file mode 100644 index 0000000..fec391b --- /dev/null +++ b/fw/fe310/phone/app/status.c @@ -0,0 +1,68 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> + +#include <eos.h> +#include <dev/net.h> +#include <net/cell.h> + +#include <eve/eve.h> +#include <eve/eve_kbd.h> +#include <eve/eve_font.h> + +#include <eve/screen/window.h> +#include <eve/screen/page.h> +#include <eve/screen/form.h> + +#include "app.h" +#include "status.h" + +void app_status_init(EVEView *view, EVEWindow *win) { + eve_view_init(view, win, app_status_draw, app_status_touch, NULL, NULL); + eve_view_set_color_bg(view, 0x20, 0x20, 0x20); +} + +int app_status_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t tag0) { + unsigned char state = 0; + int8_t touch_idx; + + /* only first touch */ + touch_idx = eve_touch_get_idx(touch); + if (touch_idx != 0) return 0; + + evt = eve_touch_evt(touch, evt, tag0, view->tag, 2); + if (evt & EVE_TOUCH_ETYPE_POINT_UP) { + view->param = NULL; + return 1; + } + return 0; +} + +uint8_t app_status_draw(EVEView *view, uint8_t tag0) { + uint8_t tag_opt = EVE_TOUCH_OPT_TRACK | EVE_TOUCH_OPT_TRACK_XY; + char *status_msg = view->param; + + tag0 = eve_view_clear(view, tag0, tag_opt); + + if (tag0 != EVE_NOTAG) { + eve_touch_set_opt(tag0, eve_touch_get_opt(tag0) | tag_opt); + eve_cmd_dl(TAG(tag0)); + tag0++; + } + + if (status_msg) eve_cmd(CMD_TEXT, "hhhhs", 0, 0, 31, 0, status_msg); + + return tag0; +} + +void app_status_set_msg(char *msg) { + EVEView *status; + + status = app_search_view("status"); + if (status == NULL) return; + + status->param = msg; + + if (!eve_selected()) app_refresh(); +} |