From 5d88349c60459f44cb6614852abb00d0f58d6e8f Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 4 Sep 2022 18:19:30 +0200 Subject: new init --- fw/fe310/eos/eos.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'fw/fe310/eos/eos.c') 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 +#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(); } -- cgit v1.2.3