Forked para SNOCC

Dependencies:   GPS

Dependents:   SNOCC_V1 SNOCC_V2

Fork of RA8875 by SNOCC

Revision:
61:8f3153bf0baa
Parent:
60:2dfd574f63bd
Child:
62:ba5d33438fda
--- a/RA8875.cpp	Sat Aug 16 19:26:17 2014 +0000
+++ b/RA8875.cpp	Sun Aug 17 13:46:06 2014 +0000
@@ -71,6 +71,10 @@
 //{
 //}
 
+uint16_t RA8875::GetDrawingLayer(void)
+{
+    return (ReadCommand(0x41) & 0x01);
+}
 
 RetCode_t RA8875::SelectDrawingLayer(uint16_t layer)
 {
@@ -694,13 +698,30 @@
 }
 
 
-RetCode_t RA8875::cls(void)
+RetCode_t RA8875::cls(uint16_t layers)
 {
+    RetCode_t ret;
+    
     PERFORMANCE_RESET;
-    clsw(FULLWINDOW);
-    SetTextCursor(0,0);
+    if (layers == 0) {
+        ret = clsw(FULLWINDOW);
+        ret = SetTextCursor(0,0);
+    } else if (layers > 3) {
+        ret = bad_parameter;
+    } else {
+        uint16_t prevLayer = GetDrawingLayer();
+        if (layers & 1) {
+            SelectDrawingLayer(0);
+            clsw(FULLWINDOW);
+        }
+        if (layers & 2) {
+            SelectDrawingLayer(1);
+            clsw(FULLWINDOW);
+        }
+        ret = SelectDrawingLayer(prevLayer);
+    }
     REGISTERPERFORMANCE(PRF_CLS);
-    return noerror;
+    return ret;
 }