From 59e5e2f5cc58779d0dcc7ea49db336114f57bb34 Mon Sep 17 00:00:00 2001
From: Pierre-noel Bouteville <pn_bouteville@yahoo.fr>
Date: Wed, 7 Oct 2015 14:29:23 -0600
Subject: [PATCH] drivers/lcd/st7565.c:  Extend to include support for the
 ERC12864-3.  From  Pierre-noel Bouteville

---
 ChangeLog            |  3 +++
 arch                 |  2 +-
 drivers/lcd/Kconfig  |  3 +++
 drivers/lcd/st7565.c | 11 +++++++++++
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index e3968d2772..6aa0e2b1ef 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -11011,3 +11011,6 @@
 	* libc/stdlib/lib_qsort.c and include/stdlib.h:  Make coding style
 	  more conformant, take description from OpenGroup.org, rename formal
 	  parameters to match names used on OpenGroup.org (2015-10-02).
+	* drivers/lcd/st7565.c:  Extend to include support for the ERC12864-3.
+	  From  Pierre-noel Bouteville (2015-10-07).
+
diff --git a/arch b/arch
index 0f4940ff63..0b8c98bfac 160000
--- a/arch
+++ b/arch
@@ -1 +1 @@
-Subproject commit 0f4940ff6339d4a4e4b8fdfeb3af8dd54f77b93f
+Subproject commit 0b8c98bfac171b330430a02070ecbe8bb9618de3
diff --git a/drivers/lcd/Kconfig b/drivers/lcd/Kconfig
index a895ca0dea..a7be77550c 100644
--- a/drivers/lcd/Kconfig
+++ b/drivers/lcd/Kconfig
@@ -564,6 +564,9 @@ choice
 config NHD_C12864KGZ
 	bool "like NHD C12864KGZ"
 
+config ERC_12864_3
+	bool "like ERC12864-3"
+
 endchoice
 
 config ST7565_NINTERFACES
diff --git a/drivers/lcd/st7565.c b/drivers/lcd/st7565.c
index 592c39d3ae..fb42531d2a 100644
--- a/drivers/lcd/st7565.c
+++ b/drivers/lcd/st7565.c
@@ -1025,6 +1025,17 @@ FAR struct lcd_dev_s *st7565_initialize(FAR struct st7565_lcd_s *lcd,
   (void)st7565_send_one_data(priv, ST7565_POWERCTRL_INT);
   (void)st7565_send_one_data(priv, ST7565_SETSTARTLINE);
 
+#elif CONFIG_ERC_12864_3
+
+  (void)st7565_send_one_data(priv, ST7565_ADCNORMAL);
+  (void)st7565_send_one_data(priv, ST7565_SETCOMREVERSE);
+  (void)st7565_send_one_data(priv, ST7565_BIAS_1_9);
+  (void)st7565_send_one_data(priv, ST7565_POWERCTRL_INT);
+  (void)st7565_send_one_data(priv, ST7565_REG_RES_5_5);
+  (void)st7565_send_one_data(priv, ST7565_SETEVMODE);
+  (void)st7565_send_one_data(priv, ST7565_SETEVREG(0x24));
+  (void)st7565_send_one_data(priv, ST7565_SETSTARTLINE);
+
 #else
 #  error "No initialization sequence selected"
 #endif
-- 
GitLab