C12832 LCD Display Generic Interface

Public Methods

    /** Create a C12832 object connected to SPI1
      *
      */
    C12832(PinName mosi, PinName sck, PinName reset, PinName a0, PinName ncs, const char* name = "LCD");
 
 
    /** Get the width of the screen in pixel
      *
      * @param
      * @returns width of screen in pixel
      *
      */
    virtual int width();
 
    /** Get the height of the screen in pixel
     *
     * @returns height of screen in pixel
     *
     */
    virtual int height();
 
    /** Draw a pixel at x,y black or white
     *
     * @param x horizontal position
     * @param y vertical position
     * @param colour ,1 set pixel ,0 erase pixel
     */
    virtual void pixel(int x, int y,int colour);
 
    /** draw a circle
      *
      * @param x0,y0 center
      * @param r radius
      * @param colour ,1 set pixel ,0 erase pixel
      *
      */
    void circle(int x, int y, int r, int colour);
 
    /** draw a filled circle
     *
     * @param x0,y0 center
     * @param r radius
     * @param color ,1 set pixel ,0 erase pixel
     *
     * use circle with different radius,
     * can miss some pixel
     */
    void fillcircle(int x, int y, int r, int colour);
 
    /** draw a 1 pixel line
      *
      * @param x0,y0 start point
      * @param x1,y1 stop point
      * @param color ,1 set pixel ,0 erase pixel
      *
      */
    void line(int x0, int y0, int x1, int y1, int colour);
 
    /** draw a rect
    *
      * @param x0,y0 top left corner
      * @param x1,y1 down right corner
      * @param color 1 set pixel ,0 erase pixel
      *                                                   *
    */
    void rect(int x0, int y0, int x1, int y1, int colour);
 
    /** draw a filled rect
      *
      * @param x0,y0 top left corner
      * @param x1,y1 down right corner
      * @param color 1 set pixel ,0 erase pixel
      *
      */
    void fillrect(int x0, int y0, int x1, int y1, int colour);
 
    /** copy display buffer to lcd
      *
      */
    void copy_to_lcd(void);
 
    /** set the contrast level
      *
      */
    void set_contrast(unsigned int o);
 
    /** read the contrast level
      *
      */
    unsigned int get_contrast(void);
 
    /** invert the screen
      *
      * @param o = 0 normal, 1 invert
      */
    void invert(unsigned int o);
 
    /** clear the screen
       *
       */
    virtual void cls(void);
 
    /** set the drawing mode
      *
      * @param mode NORMAl or XOR
      */
    void setmode(int mode);
 
    /** calculate the max number of columns
     *
     * @returns max column
     * depends on actual font size
     *
     */
    virtual int columns(void);
 
    /** calculate the max number of rows
     *
     * @returns max row
     * depends on actual font size
     *
     */
    virtual int rows(void);

    /** put a char on the screen
     *
     * @param value char to print
     * @returns printed char
     *
     */
    virtual int _putc(int value);
 
    /** draw a character on given position out of the active font to the LCD
     *
     * @param x x-position of char (top left)
     * @param y y-position
     * @param c char to print
     *
     */
    virtual void character(int x, int y, int c);
 
    /** setup cursor position
     *
     * @param x x-position (top left)
     * @param y y-position
     */
    virtual void locate(int x, int y);
    
    /** setup auto update of screen 
      *
      * @param up 1 = on , 0 = off
      * if switched off the program has to call copy_to_lcd() 
      * to update screen from framebuffer
      */
    void set_auto_up(unsigned int up);
 
    /** get status of the auto update function
      *
      *  @returns if auto update is on
      */
    unsigned int get_auto_up(void);
 
    /** select the font to use
      *
      * @param f pointer to font array
      *
      *   font array can created with GLCD Font Creator from http://www.mikroe.com
      *   you have to add 4 parameter at the beginning of the font array to use:
      *   - the number of byte / char
      *   - the vertial size in pixel
      *   - the horizontal size in pixel
      *   - the number of byte per vertical line
      *   you also have to change the array to char[]
      *
      */
    void set_font(unsigned char* f);
    
    /** print bitmap to buffer
      *
      * @param bm Bitmap in flash
      * @param x  x start
      * @param y  y start 
      *
      */
 
    void print_bm(Bitmap bm, int x, int y);

© 2017   Dr Alun Moon
alun.moon@northumbria.ac.uk