Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

See Components - RA8875 Based Display

Enhanced touch-screen support - where it previous supported both the Resistive Touch and Capacitive Touch based on the FT5206 Touch Controller, now it also has support for the GSL1680 Touch Controller.

Offline Help Manual (Windows chm)

/media/uploads/WiredHome/ra8875.zip.bin (download, rename to .zip and unzip)

GraphicsDisplay.h

Committer:
WiredHome
Date:
2014-01-19
Revision:
29:422616aa04bd
Parent:
19:3f82c1161fd2
Child:
31:c72e12cd5c67

File content as of revision 29:422616aa04bd:

/* mbed GraphicsDisplay Display Library Base Class
 * Copyright (c) 2007-2009 sford
 * Released under the MIT License: http://mbed.org/license/mit
 *
 * A library for providing a common base class for Graphics displays
 * To port a new display, derive from this class and implement
 * the constructor (setup the display), pixel (put a pixel
 * at a location), width and height functions. Everything else
 * (locate, printf, putc, cls, window, putp, fill, blit, blitbit) 
 * will come for free. You can also provide a specialised implementation
 * of window and putp to speed up the results
 */

#ifndef MBED_GRAPHICSDISPLAY_H
#define MBED_GRAPHICSDISPLAY_H

#include "TextDisplay.h"

class GraphicsDisplay : public TextDisplay {

public:         
          
    GraphicsDisplay(const char* name);
     
    virtual RetCode_t pixel(unsigned int x, unsigned int y, color_t colour) = 0;
    virtual int width() = 0;
    virtual int height() = 0;
        
    virtual void window(unsigned int x,unsigned int y,unsigned int w,unsigned int h);
    virtual void putp(int colour);
    
    virtual RetCode_t cls();
    virtual void fill(int x, int y, int w, int h, int colour);
    virtual void blit(int x, int y, int w, int h, const int * colour);    
    
    virtual int blitbit(int x, int y, int w, int h, const char * colour);
    
    /// This method transfers one character from the external font data
    /// to the screen.
    ///
    /// @note the font data is in a special format as generate by
    ///         the mikroe font creator. \\
    ///         See http://www.mikroe.com/glcd-font-creator/
    ///
    /// @param x is the horizontal pixel coordinate
    /// @param y is the vertical pixel coordinate
    /// @param fontTable is the base of the table which has the metrics
    /// @param fontChar is the start of that record in the table for the char (e.g. 'A' - 'Z')
    /// @returns how far the cursor should advance to the right in pixels
    ///
    virtual int fontblit(int x, int y, const unsigned char * fontTable, const unsigned char * fontChar);
    
    /// prints one character at the specified coordinates.
    ///
    /// This will print the character at the specified pixel coordinates.
    ///
    /// @param x is the horizontal offset in pixels.
    /// @param y is the vertical offset in pixels.
    /// @param value is the character to print.
    /// @returns number of pixels to index to the right if a character was printed, 0 otherwise.
    ///
    virtual int character(int x, int y, int value);
    
    virtual int columns();
    virtual int rows();
    virtual RetCode_t set_font(const unsigned char * font = NULL);
    
protected:
    const unsigned char * font;     ///< reference to an external font somewhere in memory
    
    // pixel location
    short _x;
    short _y;
    
    // window location
    short _x1;
    short _x2;
    short _y1;
    short _y2;
};

#endif