From 605518b4c2488d45bc778d0f7180bac0f877b0a4 Mon Sep 17 00:00:00 2001
From: Uros Majstorovic <majstor@majstor.org>
Date: Thu, 20 May 2021 19:23:26 +0200
Subject: test app template

---
 fw/fe310/test/Makefile |  2 +-
 fw/fe310/test/main.c   | 10 +++++++++-
 fw/fe310/test/test.c   | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 fw/fe310/test/test.h   |  2 ++
 4 files changed, 64 insertions(+), 2 deletions(-)
 create mode 100644 fw/fe310/test/test.c
 create mode 100644 fw/fe310/test/test.h

(limited to 'fw/fe310/test')

diff --git a/fw/fe310/test/Makefile b/fw/fe310/test/Makefile
index c5f68fb..8476db8 100644
--- a/fw/fe310/test/Makefile
+++ b/fw/fe310/test/Makefile
@@ -5,7 +5,7 @@ CRYPTO_DIR = ../../../crypto
 CFLAGS += -I.. -I../eos -I../bsp/include -I../bsp/drivers -I$(CRYPTO_DIR)
 LDFLAGS = $(CFLAGS) -L.. -Wl,--gc-sections -nostartfiles -nostdlib -Wl,--start-group -lc -lm -lgcc -leos -Wl,--end-group -T../bsp/default.lds
 
-DEPS = main.o status.o cell_dev.o cell_pdp.o phone.o modem.o wifi.o cam.o test.o
+DEPS = main.o status.o cell_dev.o cell_pdp.o phone.o modem.o wifi.o cam.o fs.o test.o
 TARGET = phone
 
 all: $(TARGET)
diff --git a/fw/fe310/test/main.c b/fw/fe310/test/main.c
index 367c3b5..844dedc 100644
--- a/fw/fe310/test/main.c
+++ b/fw/fe310/test/main.c
@@ -24,6 +24,7 @@
 #include "modem.h"
 #include "wifi.h"
 #include "cam.h"
+#include "fs.h"
 #include "test.h"
 
 void app_home_page(EVEWindow *window, EVEViewStack *stack) {
@@ -58,6 +59,12 @@ void app_home_page(EVEWindow *window, EVEViewStack *stack) {
             .widget.spec.page.title = "Camera",
             .widget.spec.page.constructor = app_cam
         },
+        {
+            .widget.type = EVE_WIDGET_TYPE_PAGE,
+            .widget.g.w = APP_SCREEN_W,
+            .widget.spec.page.title = "File system",
+            .widget.spec.page.constructor = app_fs
+        },
         {
             .widget.type = EVE_WIDGET_TYPE_PAGE,
             .widget.g.w = APP_SCREEN_W,
@@ -66,7 +73,7 @@ void app_home_page(EVEWindow *window, EVEViewStack *stack) {
         },
     };
 
-    EVEForm *form = eve_form_create(window, stack, spec, 6, NULL, NULL, NULL);
+    EVEForm *form = eve_form_create(window, stack, spec, 7, NULL, NULL, NULL);
 }
 
 int main() {
@@ -80,6 +87,7 @@ int main() {
     app_wifi_init();
     app_cell_dev_init();
     app_cell_pdp_init();
+    app_fs_init();
 
     eos_evtq_loop();
 }
diff --git a/fw/fe310/test/test.c b/fw/fe310/test/test.c
new file mode 100644
index 0000000..bc774d9
--- /dev/null
+++ b/fw/fe310/test/test.c
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <eos.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 <eve/widget/widgets.h>
+
+#include <app/app_root.h>
+
+#include <board.h>
+
+#include "test.h"
+
+#include <stdio.h>
+
+int app_test_uievt(EVEForm *form, uint16_t evt, void *param) {
+    int ret = 0;
+
+    switch (evt) {
+        case EVE_UIEVT_PAGE_TOUCH:
+            printf("PAGE TOUCH\n");
+            break;
+
+        default:
+            ret = eve_form_uievt(form, evt, param);
+            break;
+    }
+    return ret;
+}
+
+void app_test(EVEWindow *window, EVEViewStack *stack) {
+    EVEWidgetSpec spec[] = {
+        {
+            .widget.type = EVE_WIDGET_TYPE_SPACER,
+            .widget.g.h = 1,
+        },
+    };
+    EVEForm *form = eve_form_create(window, stack, spec, 1, app_test_uievt, NULL, app_test_close);
+}
+
+void app_test_close(EVEForm *form) {
+    eve_form_destroy(form);
+}
diff --git a/fw/fe310/test/test.h b/fw/fe310/test/test.h
new file mode 100644
index 0000000..daf1f1a
--- /dev/null
+++ b/fw/fe310/test/test.h
@@ -0,0 +1,2 @@
+void app_test(EVEWindow *window, EVEViewStack *stack);
+void app_test_close(EVEForm *form);
-- 
cgit v1.2.3