Base LCDPanel based, required for all LCDPanel drivers
Diff: LCDPanel.h
- Revision:
- 1:073d4f161f23
- Parent:
- 0:3f345274c737
- Child:
- 2:ab4040a7e8c9
--- a/LCDPanel.h Fri Mar 09 00:55:25 2012 +0000 +++ b/LCDPanel.h Fri Mar 09 01:49:18 2012 +0000 @@ -1,40 +1,42 @@ -/* -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; - -}; - +/* +Placeholder for Copyright notice, etc + +Author: silviogissi +*/ + +#ifndef LCDPANEL_BASE_H +#define LCDPANEL_BASE_H + +#include "mbed.h" + +class LCDPanel { + + public: + LCDPanel(unsigned int width, unsigned int height, PinName cs); + + 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 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