Base LCDPanel based, required for all LCDPanel drivers

Revision:
0:3f345274c737
Child:
1:073d4f161f23
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCDPanel.h	Fri Mar 09 00:55:25 2012 +0000
@@ -0,0 +1,40 @@
+/*
+Placeholder for Copyright notice, etc
+
+Author: silviogissi
+*/
+
+#ifndef LCDPANEL_BASE_H
+#define LCDPANEL_BASE_H
+
+class LCDPanel {
+
+  public:
+    LCDPanel(unsigned int width, unsigned int height);
+
+    virtual void fill(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned int color);
+    virtual void fill(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, const unsigned int* color);
+    virtual void set_pixel(unsigned int x, unsigned int y, unsigned int color);
+    
+    inline unsigned int height() { return _ymax+1; }
+    inline unsigned int width() { return _xmax+1; }
+    
+  protected:
+    unsigned int _ymax;
+    unsigned int _xmax;
+    DigitalOut _cs;
+    
+    class CsTransaction
+    {
+        private: LCDPanel &p;
+        public:
+            CsTransaction(LCDPanel* panel) : p(panel) { p._cs=0; }
+            ~CsTransaction() { p._cs=1; }
+    }
+     
+    virtual void pixel(unsigned int x, unsigned int y, unsigned int color)=0;
+    virtual void window(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2)=0;
+
+};
+
+#endif // LCDPANEL_BASE_H
\ No newline at end of file