From b0e84c72d7a533f62ca750a73445da7fcebe8d18 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Wed, 17 Nov 2021 20:42:47 +0100 Subject: wakeup cause added to init functions --- fw/fe310/eos/eve/eve.c | 11 ++++++----- fw/fe310/eos/eve/eve.h | 2 +- fw/fe310/eos/eve/eve_touch.c | 6 ++++-- fw/fe310/eos/eve/eve_touch.h | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) (limited to 'fw/fe310/eos/eve') diff --git a/fw/fe310/eos/eve/eve.c b/fw/fe310/eos/eve/eve.c index f4aae01..0fb55d4 100644 --- a/fw/fe310/eos/eve/eve.c +++ b/fw/fe310/eos/eve/eve.c @@ -1,6 +1,7 @@ #include #include +#include "power.h" #include "eve.h" #define EVE_MEM_WRITE 0x800000 @@ -434,12 +435,12 @@ static int _init(int touch_calibrate, uint32_t *touch_matrix, uint8_t gpio_dir) return EVE_OK; } -int eve_init(int pwr_on, int touch_calibrate, uint32_t *touch_matrix, uint8_t gpio_dir) { - eve_spi_start(); +int eve_init(uint8_t wakeup_cause, int touch_calibrate, uint32_t *touch_matrix, uint8_t gpio_dir) { + int rst = (wakeup_cause == EOS_PWR_WAKE_RST); - pwr_on = 1; // override this for now + eve_spi_start(); - if (pwr_on) { + if (rst) { int rv = _init(touch_calibrate, touch_matrix, gpio_dir); if (rv) return rv; } else { @@ -447,7 +448,7 @@ int eve_init(int pwr_on, int touch_calibrate, uint32_t *touch_matrix, uint8_t gp eve_active(); } - eve_touch_init(pwr_on, touch_calibrate, touch_matrix); + eve_touch_init(wakeup_cause, touch_calibrate, touch_matrix); eve_platform_init(); eve_spi_stop(); diff --git a/fw/fe310/eos/eve/eve.h b/fw/fe310/eos/eve/eve.h index 2f26edf..11d59cd 100644 --- a/fw/fe310/eos/eve/eve.h +++ b/fw/fe310/eos/eve/eve.h @@ -67,4 +67,4 @@ void eve_sleep(void); void eve_wake(void); void eve_brightness(uint8_t b); -int eve_init(int pwr_on, int touch_calibrate, uint32_t *touch_matrix, uint8_t gpio_dir); +int eve_init(uint8_t wakeup_cause, int touch_calibrate, uint32_t *touch_matrix, uint8_t gpio_dir); diff --git a/fw/fe310/eos/eve/eve_touch.c b/fw/fe310/eos/eve/eve_touch.c index aaa3788..77a0bf9 100644 --- a/fw/fe310/eos/eve/eve_touch.c +++ b/fw/fe310/eos/eve/eve_touch.c @@ -2,6 +2,7 @@ #include #include +#include "power.h" #include "eve.h" static int touch_intr_mask = EVE_INT_TAG | EVE_INT_TOUCH; @@ -340,7 +341,8 @@ static void _init(int touch_calibrate, uint32_t *touch_matrix) { while(eve_read8(REG_INT_FLAGS)); } -void eve_touch_init(int pwr_on, int touch_calibrate, uint32_t *touch_matrix) { +void eve_touch_init(uint8_t wakeup_cause, int touch_calibrate, uint32_t *touch_matrix) { + int rst = (wakeup_cause == EOS_PWR_WAKE_RST); int i; eve_vtrack_init(); @@ -350,7 +352,7 @@ void eve_touch_init(int pwr_on, int touch_calibrate, uint32_t *touch_matrix) { touch->eevt |= EVE_TOUCH_EETYPE_NOTOUCH; } - if (pwr_on) _init(touch_calibrate, touch_matrix); + if (rst) _init(touch_calibrate, touch_matrix); } void eve_touch_set_handler(eve_touch_handler_t handler, void *param) { diff --git a/fw/fe310/eos/eve/eve_touch.h b/fw/fe310/eos/eve/eve_touch.h index d9e9c9a..148ed48 100644 --- a/fw/fe310/eos/eve/eve_touch.h +++ b/fw/fe310/eos/eve/eve_touch.h @@ -101,7 +101,7 @@ typedef void (*eve_touch_handler_t) (EVETouch *, uint16_t, uint8_t, void *); void eve_handle_touch(void); void eve_handle_time(void); -void eve_touch_init(int pwr_on, int touch_calibrate, uint32_t *touch_matrix); +void eve_touch_init(uint8_t wakeup_cause, int touch_calibrate, uint32_t *touch_matrix); void eve_touch_set_handler(eve_touch_handler_t handler, void *handler_param); EVETouch *eve_touch_get(int i); int8_t eve_touch_get_idx(EVETouch *touch); -- cgit v1.2.3