Basically i glued Peter Drescher and Simon Ford libs in a GraphicsDisplay class, then derived TFT or LCD class (which inherits Protocols class), then the most derived ones (Inits), which are per-display and are the only part needed to be adapted to diff hw.

Fork of UniGraphic by GraphicsDisplay

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers UC1608.h Source File

UC1608.h

00001 #ifndef MBED_UC1608_H
00002 #define MBED_UC1608_H
00003 
00004 
00005 
00006 #include "mbed.h"
00007 #include "LCD.h"
00008 
00009 /** Class for UC1608 display controller
00010 * to be copypasted and adapted for other controllers
00011 */
00012 class UC1608 : public LCD
00013 {
00014  
00015  public:
00016 
00017     /** Create a PAR display interface
00018     * @param displayproto only supports PAR_8
00019     * @param port GPIO port name to use
00020     * @param CS pin connected to CS of display
00021     * @param reset pin connected to RESET of display
00022     * @param DC pin connected to data/command of display
00023     * @param WR pin connected to SDI of display
00024     * @param RD pin connected to RS of display
00025     * @param name The name used by the parent class to access the interface
00026     * @param LCDSIZE_X x size in pixel - optional
00027     * @param LCDSIZE_Y y size in pixel - optional
00028     */ 
00029     UC1608(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char* name, unsigned int LCDSIZE_X = 240, unsigned  int LCDSIZE_Y = 120);
00030   
00031     /** Create an SPI display interface
00032     * @param displayproto SPI_8 or SPI_16
00033     * @param Hz SPI speed in Hz
00034     * @param mosi SPI pin
00035     * @param miso SPI pin
00036     * @param sclk SPI pin
00037     * @param CS pin connected to CS of display
00038     * @param reset pin connected to RESET of display
00039     * @param DC pin connected to data/command of display
00040     * @param name The name used by the parent class to access the interface
00041     * @param LCDSIZE_X x size in pixel - optional
00042     * @param LCDSIZE_Y y size in pixel - optional
00043     */ 
00044     UC1608(proto_t displayproto, int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC, const char* name , unsigned int LCDSIZE_X = 240, unsigned  int LCDSIZE_Y = 120);
00045   
00046     /** set the contrast of the screen
00047       * @note here overrided because of not standard command
00048       * @param o contrast 0-63
00049       */
00050     virtual void set_contrast(int o);
00051     
00052     /** Set ChipSelect high or low
00053     * @note here overriding the std one, cause CS inverted
00054     * @param enable 0/1   
00055     */
00056     virtual void BusEnable(bool enable);
00057   
00058 protected:
00059     
00060     
00061     /** Init command sequence  
00062     */
00063     void init();
00064     
00065     /** set mirror mode
00066       * @note here overriding the LCD class default one because of not standard commands
00067       * @param mode NONE, X, Y, XY 
00068       */
00069     virtual void mirrorXY(mirror_t mode);
00070     
00071     
00072 
00073 
00074 
00075 };
00076 #endif