Base LCDPanel based, required for all LCDPanel drivers

LCDPanel.h

Committer:
silviogissi
Date:
2012-03-09
Revision:
0:3f345274c737
Child:
1:073d4f161f23

File content as of revision 0:3f345274c737:

/*
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