diff options
author | Uros Majstorovic <majstor@majstor.org> | 2020-05-17 04:48:51 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2020-05-17 04:48:51 +0200 |
commit | 51453315e18632c00e4a43407ec63a4b69b17e80 (patch) | |
tree | 6d9fceebd172a9c3d02d8806e5a749223fdbfdca /code/fe310/eos/eve/eve.c | |
parent | d4ceadf1afc2b3c8120d65ea1f03203df5714d7a (diff) |
power management fix
Diffstat (limited to 'code/fe310/eos/eve/eve.c')
-rw-r--r-- | code/fe310/eos/eve/eve.c | 9 |
1 files changed, 6 insertions, 3 deletions
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; } |