diff options
author | Uros Majstorovic <majstor@majstor.org> | 2025-07-28 23:27:12 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2025-07-28 23:27:12 +0200 |
commit | 58f41971b1e801ad2fbcea08e5152afa2b18ca73 (patch) | |
tree | 51793b55b350f7807d5d1b7e1401b50f402ccc48 /fw/fe310/eos/dev/lcd.c | |
parent | dab5a1fbd188f8f9436df1b3dff6e344c444fc23 (diff) |
sys logging added; power management reimplemented; bugfixes;
Diffstat (limited to 'fw/fe310/eos/dev/lcd.c')
-rw-r--r-- | fw/fe310/eos/dev/lcd.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/fw/fe310/eos/dev/lcd.c b/fw/fe310/eos/dev/lcd.c index 6c005b9..01d86e9 100644 --- a/fw/fe310/eos/dev/lcd.c +++ b/fw/fe310/eos/dev/lcd.c @@ -13,9 +13,8 @@ #include "eve/eve.h" #include "egpio.h" +#include "egpio_priv.h" #include "spi.h" -#include "eve.h" -#include "pwr.h" #include "drv/ili9806e.h" #include "lcd.h" @@ -38,6 +37,10 @@ static int lcd_disable(void) { return rv; } +static int lcd_enabled(void) { + return eos_egpio_get_val(EGPIO_PIN_LCD_EN); +} + static int lcd_select(void) { int rv; @@ -52,6 +55,7 @@ static int lcd_select(void) { GPIO_REG(GPIO_OUTPUT_EN) &= ~(1 << SPI_CSPIN_LCD); GPIO_REG(GPIO_OUTPUT_XOR) &= ~(1 << SPI_CSPIN_LCD); GPIO_REG(GPIO_OUTPUT_VAL) &= ~(1 << SPI_CSPIN_LCD); + return rv; } @@ -60,6 +64,7 @@ static int lcd_select(void) { static void lcd_deselect(void) { eos_spi_deselect(); + GPIO_REG(GPIO_OUTPUT_EN) &= ~(1 << SPI_CSPIN_LCD); GPIO_REG(GPIO_OUTPUT_XOR) &= ~(1 << SPI_CSPIN_LCD); GPIO_REG(GPIO_OUTPUT_VAL) &= ~(1 << SPI_CSPIN_LCD); @@ -118,6 +123,8 @@ int eos_lcd_init(void) { int eos_lcd_sleep(void) { int rv; + if (!lcd_enabled()) return EOS_ERR; + rv = lcd_sleep(); return rv; } @@ -125,6 +132,8 @@ int eos_lcd_sleep(void) { int eos_lcd_wake(void) { int rv; + if (lcd_enabled()) return EOS_ERR; + rv = lcd_init(); return rv; } |