summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eos.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-12-09 23:50:58 +0100
committerUros Majstorovic <majstor@majstor.org>2021-12-09 23:50:58 +0100
commit7d03a941be6e9226e71cb5f5b4f7949e06bbfb02 (patch)
treecde9218dbe97837f972c426552c463f5f2a6a256 /fw/fe310/eos/eos.c
parent9c8f5a5e8f11e4a5012d55b96afae290242b8fdd (diff)
improved init process
Diffstat (limited to 'fw/fe310/eos/eos.c')
-rw-r--r--fw/fe310/eos/eos.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/fw/fe310/eos/eos.c b/fw/fe310/eos/eos.c
index 68d299a..bf0f0da 100644
--- a/fw/fe310/eos/eos.c
+++ b/fw/fe310/eos/eos.c
@@ -3,7 +3,7 @@
#include "event.h"
#include "interrupt.h"
#include "timer.h"
-#include "power.h"
+#include "pwr.h"
#include "i2s.h"
#include "i2c.h"
#include "uart.h"
@@ -23,25 +23,24 @@
#include "eos.h"
void eos_init(void) {
- uint8_t wakeup_cause = eos_power_wakeup_cause();
+ uint8_t wakeup_cause = eos_pwr_wakeup_cause();
uint32_t touch_matrix[6] = {0xfa46,0xfffffcf6,0x422fe,0xffffff38,0x10002,0xf3cb0};
int touch_calibrate = 0;
int rv;
printf("INIT:%d\n", wakeup_cause);
- 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);
+ eos_evtq_init(wakeup_cause);
+ eos_intr_init(wakeup_cause);
+ eos_timer_init(wakeup_cause);
+ eos_uart_init(wakeup_cause);
+
+ rv = eos_pwr_init(wakeup_cause);
+ if (rv) printf("PWR 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);
@@ -50,14 +49,13 @@ void eos_init(void) {
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);
+
+ eos_i2c_start();
rv = eos_bq25895_init(wakeup_cause);
+ eos_i2c_stop();
if (rv) printf("BQ25895 INIT ERR:%d\n", rv);
- eos_spi_select(EOS_SPI_DEV_EVE);
rv = eos_eve_init(wakeup_cause, EVE_GPIO_DIR, touch_calibrate, touch_matrix);
- eos_spi_deselect();
if (rv) printf("EVE INIT ERR:%d\n", rv);
rv = eos_lcd_init(wakeup_cause);
@@ -73,14 +71,13 @@ void eos_init(void) {
void eos_run(uint8_t wakeup_cause) {
int rv;
- eos_spi_select(EOS_SPI_DEV_EVE);
rv = eos_eve_run(wakeup_cause);
- eos_spi_deselect();
if (rv) printf("EVE RUN ERR:%d\n", rv);
- eos_wifi_init();
- eos_cell_init();
- eos_sock_init();
+ eos_pwr_netinit();
+ eos_wifi_netinit();
+ eos_cell_netinit();
+ eos_sock_netinit();
rv = eos_net_run(wakeup_cause);
if (rv) printf("NET RUN ERR:%d\n", rv);
}