SSD1322: add power off/on methods draft

Sun, 01 Nov 2020 22:10:10 +0100

author
David Douard <david.douard@sdf3.org>
date
Sun, 01 Nov 2020 22:10:10 +0100
changeset 40
069bbd5ee3e4
parent 39
63c6a720cb97
child 41
5bed3318e563

SSD1322: add power off/on methods

lib/unigraphic/SSD1322.cpp file | annotate | diff | comparison | revisions
lib/unigraphic/SSD1322.h file | annotate | diff | comparison | revisions
--- a/lib/unigraphic/SSD1322.cpp	Tue Oct 27 21:48:28 2020 +0100
+++ b/lib/unigraphic/SSD1322.cpp	Sun Nov 01 22:10:10 2020 +0100
@@ -428,12 +428,22 @@
 // reset and init the lcd controller
 void SSD1322::init()
 {
-    /* Start Initial Sequence ----------------------------------------------------*/
-    for (uint16_t ind=0; ind < sizeof(oledInit); ) {
+  /* Start Initial Sequence ----------------------------------------------------*/
+  for (uint16_t ind=0; ind < sizeof(oledInit); ) {
 	wr_cmd8(oledInit[ind++]);
 	uint8_t dataSize = oledInit[ind++];
 	while (dataSize--) {
 	    wr_data8(oledInit[ind++]);
 	}
-    }
- }
+  }
+}
+
+void SSD1322::power_off()
+{
+	wr_cmd8(SSD1322_CMD_SET_DISPLAY_OFF);
+}
+
+void SSD1322::power_on()
+{
+	wr_cmd8(SSD1322_CMD_SET_DISPLAY_ON);
+}
--- a/lib/unigraphic/SSD1322.h	Tue Oct 27 21:48:28 2020 +0100
+++ b/lib/unigraphic/SSD1322.h	Sun Nov 01 22:10:10 2020 +0100
@@ -44,7 +44,8 @@
 	 */
     virtual ~SSD1322() {};
 
-
+	void power_off();
+	void power_on();
 
 /////// functions that come for free, but can be overwritten///////////////////////////////////////////////////
 /////// ----------------------------------------------------///////////////////////////////////////////////////

mercurial