summaryrefslogtreecommitdiff
path: root/fw/fe310/phone/timer.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2022-09-04 18:37:42 +0200
committerUros Majstorovic <majstor@majstor.org>2022-09-04 18:37:42 +0200
commitfc98d3809e0db36d634f290417b9152f87f83e3e (patch)
treed7c0cbb883571dccfcd4028d8b7b2a2144fc2d2b /fw/fe310/phone/timer.c
parent07e6abe5d5a1813298805bea2bf9d62ad895aaaa (diff)
new phone firmware
Diffstat (limited to 'fw/fe310/phone/timer.c')
-rw-r--r--fw/fe310/phone/timer.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/fw/fe310/phone/timer.c b/fw/fe310/phone/timer.c
new file mode 100644
index 0000000..03593ff
--- /dev/null
+++ b/fw/fe310/phone/timer.c
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <eos.h>
+#include <soc/timer.h>
+#include <dev/net.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/app.h"
+
+#include "timer.h"
+
+static void timer(unsigned char evt) {
+ int rv;
+
+ printf("TIMER\n");
+ eos_timer_set(EOS_TIMER_ETYPE_USR, 500);
+}
+
+int timer_app(EVEWindow *window, EVEViewStack *stack) {
+ EVEFormSpec spec[] = {
+ APP_SPACERW(1,1),
+ };
+ EVEPage *page = eve_form_create(window, stack, spec, APP_SPEC_SIZE(spec), NULL, timer_close);
+ if (page == NULL) return EVE_ERR_NOMEM;
+ eos_timer_set_handler(EOS_TIMER_ETYPE_USR, timer);
+ eos_timer_set(EOS_TIMER_ETYPE_USR, 500);
+ eos_net_acquire_for_evt(EOS_EVT_TIMER | EOS_TIMER_ETYPE_USR, 1);
+
+ return EVE_OK;
+}
+
+void timer_close(EVEPage *page) {
+ eos_timer_clear(EOS_TIMER_ETYPE_USR);
+ eos_timer_set_handler(EOS_TIMER_ETYPE_USR, NULL);
+ eos_net_acquire_for_evt(EOS_EVT_TIMER | EOS_TIMER_ETYPE_USR, 0);
+ eve_form_destroy(page);
+}