From 12469dd15e82efeed819c36bbc8e090eb9be2b6e Mon Sep 17 00:00:00 2001 From: Cis van Mierlo Date: Tue, 24 May 2022 14:46:28 +0200 Subject: [PATCH] SSD1306: Added option to force reconfigure display after power off --- drivers/lcd/Kconfig | 6 ++++++ drivers/lcd/ssd1306_base.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/lcd/Kconfig b/drivers/lcd/Kconfig index b62ab6314f..08fdb24a0a 100644 --- a/drivers/lcd/Kconfig +++ b/drivers/lcd/Kconfig @@ -416,6 +416,12 @@ config SSD1306_I2CFREQ endif # LCD_SSD1306_I2C +config SSD1306_POWEROFF_RECONFIGURE + bool "Reconfigure SSD1306 after power off" + default n + ---help--- + Forces a (re)configuration of the SSD1306 after calling power off. + config LCD_SSD1351 bool "SSD1351 OLED Display Module" default n diff --git a/drivers/lcd/ssd1306_base.c b/drivers/lcd/ssd1306_base.c index 8957873f91..2e29fe90d2 100644 --- a/drivers/lcd/ssd1306_base.c +++ b/drivers/lcd/ssd1306_base.c @@ -755,6 +755,13 @@ static int ssd1306_setpower(FAR struct lcd_dev_s *dev, int power) priv->on = false; +#ifdef CONFIG_SSD1306_POWEROFF_RECONFIGURE + + /* Display is not configured anymore. */ + + priv->is_conf = false; +#else + /* Try turn off power completely */ if (priv->board_priv && priv->board_priv->set_vcc) @@ -768,6 +775,7 @@ static int ssd1306_setpower(FAR struct lcd_dev_s *dev, int power) priv->is_conf = false; } } +#endif } else {