From 51453315e18632c00e4a43407ec63a4b69b17e80 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 17 May 2020 04:48:51 +0200 Subject: power management fix --- code/fe310/eos/eve/eve.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'code/fe310/eos/eve/eve.c') diff --git a/code/fe310/eos/eve/eve.c b/code/fe310/eos/eve/eve.c index 47b07c9..430b998 100644 --- a/code/fe310/eos/eve/eve.c +++ b/code/fe310/eos/eve/eve.c @@ -11,6 +11,7 @@ static uint16_t _cmd_offset; static uint32_t _dl_addr; static uint32_t *_touch_calib; static uint8_t _brigtness; +static char _sleep; void eve_command(uint8_t command, uint8_t parameter) { eve_spi_cs_set(); @@ -243,6 +244,9 @@ void eve_standby(void) { } void eve_sleep(void) { + if (_sleep) return; + + _sleep = 1; _brigtness = eve_read8(REG_PWM_DUTY); eve_write8(REG_PWM_DUTY, 0x0); @@ -261,6 +265,7 @@ void eve_wake(void) { eve_write8(REG_CTOUCH_EXTENDED, 0x00); eve_write8(REG_PWM_DUTY, _brigtness); + _sleep = 0; } void eve_brightness(uint8_t b) { @@ -368,6 +373,7 @@ int eve_init(int pwr_on) { int rv = _init(); if (rv) return rv; } else { + _sleep = 1; eve_wake(); } @@ -375,8 +381,5 @@ int eve_init(int pwr_on) { eve_init_track(); eve_init_platform(); - eve_time_sleep(500); - eve_command(EVE_STANDBY, 0); - return EVE_OK; } -- cgit v1.2.3