summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eos.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-11-28 23:53:05 +0100
committerUros Majstorovic <majstor@majstor.org>2021-11-28 23:53:05 +0100
commitacce7d8e05ac38776d6340342f6a7868df4f7f28 (patch)
treec0e2f3934b82967e4c2aff4a3dfcc5802bc94232 /fw/fe310/eos/eos.c
parent0b0972ce96a59fb9b59c0b166e0174ba4d8dd198 (diff)
lcd driver added; fixed startup code;
Diffstat (limited to 'fw/fe310/eos/eos.c')
-rw-r--r--fw/fe310/eos/eos.c63
1 files changed, 43 insertions, 20 deletions
diff --git a/fw/fe310/eos/eos.c b/fw/fe310/eos/eos.c
index 96fc298..0b6228b 100644
--- a/fw/fe310/eos/eos.c
+++ b/fw/fe310/eos/eos.c
@@ -9,6 +9,7 @@
#include "uart.h"
#include "spi.h"
#include "spi_dev.h"
+#include "lcd.h"
#include "sdcard.h"
#include "net.h"
#include "wifi.h"
@@ -22,28 +23,46 @@
#include "eos.h"
void eos_init(void) {
- uint8_t wakeup_cause = eos_power_wakeup_cause();
+ uint8_t wakeup_cause = eos_power_wakeup_cause() | EOS_PWR_INIT;
uint32_t touch_matrix[6] = {0xfa46,0xfffffcf6,0x422fe,0xffffff38,0x10002,0xf3cb0};
int touch_calibrate = 0;
- int rst = (wakeup_cause == EOS_PWR_WAKE_RST);
-
- printf("WAKE:%d\n", wakeup_cause);
-
- eos_evtq_init(wakeup_cause);
- eos_intr_init(wakeup_cause);
- eos_timer_init(wakeup_cause);
- eos_i2s_init(wakeup_cause);
- eos_i2c_init(wakeup_cause);
- eos_uart_init(wakeup_cause);
- eos_spi_init(wakeup_cause);
- eos_spi_dev_init(wakeup_cause);
- eos_sdc_init(wakeup_cause);
- eos_net_init(wakeup_cause);
- eos_power_init(wakeup_cause);
- eos_bq25895_init(wakeup_cause);
- int rv = eve_init(wakeup_cause, touch_calibrate, touch_matrix, EVE_GPIO_DIR);
-
- printf("EVE INIT: %d\n", rv);
+ int rv;
+
+ printf("INIT:%d\n", wakeup_cause & ~EOS_PWR_INIT);
+
+ rv = eos_evtq_init(wakeup_cause);
+ if (rv) printf("EVTQ INIT ERR:%d\n", rv);
+ rv = eos_intr_init(wakeup_cause);
+ if (rv) printf("INTR INIT ERR:%d\n", rv);
+ rv = eos_timer_init(wakeup_cause);
+ if (rv) printf("TIMER INIT ERR:%d\n", rv);
+ rv = eos_i2s_init(wakeup_cause);
+ if (rv) printf("I2S INIT ERR:%d\n", rv);
+ rv = eos_i2c_init(wakeup_cause);
+ if (rv) printf("I2C INIT ERR:%d\n", rv);
+ rv = eos_uart_init(wakeup_cause);
+ if (rv) printf("UART INIT ERR:%d\n", rv);
+ rv = eos_spi_init(wakeup_cause);
+ if (rv) printf("SPI INIT ERR:%d\n", rv);
+ rv = eos_spi_dev_init(wakeup_cause);
+ if (rv) printf("SPI DEV INIT ERR:%d\n", rv);
+ rv = eos_sdc_init(wakeup_cause);
+ if (rv) printf("SDC INIT ERR:%d\n", rv);
+ rv = eos_net_init(wakeup_cause);
+ if (rv) printf("NET INIT ERR:%d\n", rv);
+ rv = eos_power_init(wakeup_cause);
+ if (rv) printf("POWER INIT ERR:%d\n", rv);
+ rv = eos_bq25895_init(wakeup_cause);
+ if (rv) printf("BQ25895 INIT ERR:%d\n", rv);
+
+ eos_spi_select(EOS_SPI_DEV_EVE);
+ rv = eve_init(wakeup_cause, touch_calibrate, touch_matrix, EVE_GPIO_DIR);
+ eos_spi_deselect();
+ if (rv) printf("EVE INIT ERR:%d\n", rv);
+
+ rv = eos_lcd_init(wakeup_cause);
+ if (rv) printf("LCD INIT ERR:%d\n", rv);
+
if (touch_calibrate) {
printf("TOUCH MATRIX:\n");
printf("uint32_t touch_matrix[6] = {0x%x,0x%x,0x%x,0x%x,0x%x,0x%x}\n", touch_matrix[0], touch_matrix[1], touch_matrix[2], touch_matrix[3], touch_matrix[4], touch_matrix[5]);
@@ -52,6 +71,10 @@ void eos_init(void) {
}
void eos_start(uint8_t wakeup_cause) {
+ eos_spi_select(EOS_SPI_DEV_EVE);
+ eve_start(wakeup_cause);
+ eos_spi_deselect();
+
eos_wifi_init();
eos_cell_init();
eos_sock_init();