summaryrefslogtreecommitdiff
path: root/fw/fe310
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2022-09-04 18:19:30 +0200
committerUros Majstorovic <majstor@majstor.org>2022-09-04 18:19:30 +0200
commit5d88349c60459f44cb6614852abb00d0f58d6e8f (patch)
treeaaa140aa3be4adcb491f8e45aa2ad95ca2a4764a /fw/fe310
parentc286437474becda19c255efa3ede6beb0f2292d9 (diff)
new init
Diffstat (limited to 'fw/fe310')
-rw-r--r--fw/fe310/eos/Makefile2
-rw-r--r--fw/fe310/eos/eos.c35
-rw-r--r--fw/fe310/eos/eos.h2
3 files changed, 30 insertions, 9 deletions
diff --git a/fw/fe310/eos/Makefile b/fw/fe310/eos/Makefile
index e9c6421..b9ba89a 100644
--- a/fw/fe310/eos/Makefile
+++ b/fw/fe310/eos/Makefile
@@ -1,5 +1,5 @@
include ../common.mk
-CFLAGS += -I$(bsp_dir)/include
+CFLAGS += -I$(bsp_dir)/include -I$(bsp_dir)/drivers
obj = eos.o msgq.o event.o unicode.o
lib = ../libeos.a
diff --git a/fw/fe310/eos/eos.c b/fw/fe310/eos/eos.c
index 03609ae..a099fc1 100644
--- a/fw/fe310/eos/eos.c
+++ b/fw/fe310/eos/eos.c
@@ -1,5 +1,9 @@
#include <stdio.h>
+#include "encoding.h"
+#include "platform.h"
+#include "prci_driver.h"
+
#include "event.h"
#include "soc/interrupt.h"
#include "soc/timer.h"
@@ -11,7 +15,9 @@
#include "dev/spi.h"
#include "dev/net.h"
+#include "dev/lcd.h"
#include "dev/sdcard.h"
+#include "dev/gt911.h"
#include "dev/bq25895.h"
#include "dev/eve.h"
@@ -22,10 +28,17 @@
#include "eos.h"
-void eos_init(void) {
- uint8_t wakeup_cause = eos_pwr_wakeup_cause();
+uint8_t eos_init(void) {
+ uint8_t wakeup_cause;
int rv;
+ SPI0_REG(SPI_REG_SCKDIV) = 8;
+
+ PRCI_use_default_clocks();
+ PRCI_use_pll(PLL_REFSEL_HFXOSC, 0, 1, 31, 1, -1, -1, -1);
+
+ wakeup_cause = eos_pwr_wakeup_cause();
+
eos_evtq_init(wakeup_cause);
eos_intr_init(wakeup_cause);
eos_timer_init(wakeup_cause);
@@ -56,11 +69,8 @@ void eos_init(void) {
rv = eos_eve_init(wakeup_cause);
if (rv) printf("EVE INIT ERR:%d\n", rv);
- eos_run(wakeup_cause);
-}
-
-void eos_run(uint8_t wakeup_cause) {
- int rv;
+ rv = eos_lcd_init(wakeup_cause);
+ if (rv) printf("LCD INIT ERR:%d\n", rv);
rv = eos_eve_run(wakeup_cause);
if (rv) printf("EVE RUN ERR:%d\n", rv);
@@ -69,10 +79,21 @@ void eos_run(uint8_t wakeup_cause) {
eos_wifi_init();
eos_sock_init();
eos_cell_init();
+
+ return wakeup_cause;
+}
+
+void eos_run(uint8_t wakeup_cause) {
+ int rv;
+
rv = eos_net_run(wakeup_cause);
if (rv) printf("NET RUN ERR:%d\n", rv);
}
void eos_run_once(void) {
+ eos_gt911_cfg_print();
+ eos_gt911_set_threshold();
+ eos_gt911_cfg_print();
+
eos_eve_calibrate();
}
diff --git a/fw/fe310/eos/eos.h b/fw/fe310/eos/eos.h
index f3caf6b..fabaaab 100644
--- a/fw/fe310/eos/eos.h
+++ b/fw/fe310/eos/eos.h
@@ -13,6 +13,6 @@
#define EOS_ERR_NET -20
-void eos_init(void);
+uint8_t eos_init(void);
void eos_run(uint8_t wakeup_cause);
void eos_run_once(void); \ No newline at end of file