TXT

lrvGUI LCDSLin for T6963oor

By Jerome Carpenter,2014-02-08 12:10
13 views 0
lrvGUI LCDSLin for T6963oor

/*

    *********************************************************************************************************

    * uC/GUI * Universal graphic software for embedded applications

    *

    * (c) Copyright 2002, Micrium Inc., Weston, FL * (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH

    *

    * µC/GUI is protected by international copyright laws. Knowledge of the

    * source code may not be used to write a similar product. This file may

    * only be used in accordance with a license and should not be redistributed

    * in any way. We appreciate your understanding and fairness. *

    ----------------------------------------------------------------------

    File : LCDSLin.C

    Purpose : Driver for LCDs using simple bus interface

Currently supported controllers:

     Toshiba T6963

     Epson SED1330

     Epson SED1335

    ----------------------------------------------------------------------

    Version-Date---Author-Explanation

    ----------------------------------------------------------------------

    2.00g 020319 JE a) Macro changed to fix NC30-error 2.00f 020204 JE a) Hardwareinterface routines renamed:

     ...DATA -> ...A0, ...CMD -> ...A1 2.00e 011112 JE a) LCD_INIT_CONTROLLER added to be able to

     execute LCD_X_Init during init 2.00d 010926 JE a) Support for LCD_SWAP_XY added 2.00c 010706 JE a) Bugfix in DrawBitLine1BPP

    2.00b 010402 RS a) LCD_GetDevCaps removed from driver

     (now LCD.c)

    2.00a 008026 RS a) Simulation interface changed 2.00 000525 JE a) Interface changed

    1.02c 000509 JE a) Simple bus interface changed for SED133x

     b) Small changes in DrawBitLine1BPP

     c) Cache initialisation to SED133x added 1.02b 000508 JE a) Simple bus interface changed for T6963 1.02a 000426 JE a) Transparent mode in DrawBitLine1BPP changed

     b) Dummy LCD_L0_SetLUTEntry inserted 1.02 000426 RS a) Changes for new LCD-driver interface V1.30 1.00a 000410 JE a) LCD_GetDevCap changed

     b) LCD_GetpCapFunc deleted

     c) LCD_DrawBitMap changed

     d) Definition for aColorIndex changed 1.00 000407 JE First release

    ---------------------------LIST OF CONFIG

    SWITCHES--------------------

    The following is a list of additional configuration switches for this driver. These switches might not be listed in the manual, because the manual mainly covers the general config switches which are supported by all drivers.

    ----------------------------------------------------------------------

    define

    ----------------------Explanation------------------------------ LCD_OPTIMIZE Controls the use of optimized routines. ----------------------------------------------------------------------

    Known problems or limitations with current version

    ----------------------------------------------------------------------

    none

    ---------------------------END-OF-HEADER------------------------------

    */

#include <string.h> /* for memset */

    #include <stddef.h> /* needed for definition of NULL */ #include "LCD_Private.h" /* private modul definitions & config */ #include "GUI_Private.h"

    #include "GUIDebug.h"

    #include "LCD_0.h" /* Defines for first display */

    #if (LCD_CONTROLLER == 6963) || (LCD_CONTROLLER == 1330) ||

(LCD_CONTROLLER == 1335) \

     && (!defined(WIN32) | defined(LCD_SIMCONTROLLER))

/*

    ********************************************************************

     * *

     * Conversion table

     * *

    ********************************************************************

    */

    static const LCD_PIXELINDEX LCD_ConversionTable[2] = {0, 1};

/*

     *********************************************************

     * *

     * Defaults for configuration *

     * *

     *********************************************************

*/

#ifndef LCD_OPTIMIZE

     #define LCD_OPTIMIZE (1)

    #endif

#ifndef LCD_CHECKBUSY

     #define LCD_CHECKBUSY (1)

    #endif

#ifndef LCD_INIT

     #define LCD_INIT()

    #endif

#ifndef LCD_WATCHDOG_TRIGGERCNT

     #define LCD_WATCHDOG_TRIGGERCNT (0)

    #endif

#ifndef LCD_KICK_WATCHDOG

     #define LCD_KICK_WATCHDOG()

    #endif

#ifndef LCD_CACHE

     #define LCD_CACHE (1) #endif

#ifndef LCD_SUPPORT_REFRESH

     #define LCD_SUPPORT_REFRESH LCD_CACHE #endif

#ifndef LCD_REVERSEMODE_SUPPORT

     #define LCD_REVERSEMODE_SUPPORT (0) #endif

#ifndef LCD_SUPPORT_VERIFY

     #define LCD_SUPPORT_VERIFY (0) #endif

    /* Switch for support of multiple pages.

     Only available with certain LCD-controllers */ #ifndef LCD_SUPPORT_PAGING

     #define LCD_SUPPORT_PAGING (0) #endif

#ifndef LCD_SCHEDULE_CNT

     #define LCD_SCHEDULE_CNT (0) #endif

#ifndef LCD_NUM_CONTROLLERS

     #define LCD_NUM_CONTROLLERS (1) #endif

#ifndef LCD_SUPPORT_CHECKINIT

     #define LCD_SUPPORT_CHECKINIT (0) #endif

/* Switch support for the LCD_CopyRect function of the driver */

    #ifndef LCD_SUPPORT_COPYRECT

     #define LCD_SUPPORT_COPYRECT (1) #endif

#ifndef LCD_INIT_CONTROLLER

     #define LCD_INIT_CONTROLLER()

    #endif

/*

     *********************************************************

     * *

     * Internal types *

     * *

     ********************************************************* */

#if LCD_BITSPERPIXEL == 1

     #define PIXELCOLOR U8

    #else

     #error LCD_BITSPERPIXEL != 1 not supported

    #endif

/*

     *********************************************************

     * *

     * Configuration switch checking *

     * *

     *********************************************************

    Please be aware that not all configuration errors can be captured !

*/

/* Check number of controllers */

    #if (LCD_NUM_CONTROLLERS != 1)

     #error "Only 1 controller supported by this driver" #endif

/*

     *********************************************************

     *

     * Defines for simulation

     *

     ********************************************************* */

#ifdef WIN32

     #undef LCD_WRITE_A0

     #undef LCD_WRITE_A1

     #undef LCD_READ_A0

     #undef LCD_READ_A1

     void SIM_WriteA1C0(U8 Data);

     void SIM_WriteA0C0(U8 cmd);

     U8 SIM_ReadA1C0(void);

     U8 SIM_ReadA0C0(void);

     #define LCD_WRITE_A1(Data) SIM_WriteA1C0(Data)

     #define LCD_WRITE_A0(cmd) SIM_WriteA0C0(cmd)

     #define LCD_READ_A1() SIM_ReadA1C0()

     #define LCD_READ_A0() SIM_ReadA0C0()

    #endif

/*

     *********************************************************

     * *

     * Standard variables for driver *

     * *

     ********************************************************* */

    static U8 Cache[((LCD_XSIZE_PHYS+7)>>3)*LCD_YSIZE_PHYS];

#if LCD_WATCHDOG_TRIGGERCNT

     int WatchdogTriggerCnt;

    #endif

#if LCD_SUPPORT_VERIFY

     static int ErrCnt;

     static int ErrStat;

    #endif

/*

     *********************************************************

     * *

     * Support for Segment/COMLUTs *

     * *

     ********************************************************* */

    /* For compatibility with older configs, define defaults */

#ifndef LCD_SUPPORT_COMTRANS

     #define LCD_SUPPORT_COMTRANS 0

    #endif

    #ifndef LCD_SUPPORT_SEGTRANS

     #define LCD_SUPPORT_SEGTRANS 0

    #endif

#if LCD_SUPPORT_COMTRANS

     extern LCD_TYPE_COMTRANS

    LCD__aLine2Com0[LCD_LASTCOM0-LCD_FIRSTCOM0+1]; #endif

#if LCD_SUPPORT_SEGTRANS

     extern LCD_TYPE_SEGTRANS

    LCD__aRow2Seg0[LCD_LASTSEG0-LCD_FIRSTSEG0+1];

    #endif

/*

     *********************************************************

     * *

     * Macros for internal use *

     * *

     ********************************************************* */

#if (LCD_SUPPORT_COMTRANS)

     #if (LCD_MIRROR_Y)

     #error LCD_MIRROR_Y not supported with COMTrans !

     #endif

     #if (LCD_MIRROR_X)

     #error LCD_MIRROR_X not supported with COMTrans !

     #endif

    #endif

    #if (!LCD_SUPPORT_COMTRANS && !LCD_SUPPORT_SEGTRANS)

     #if (!LCD_MIRROR_X && !LCD_MIRROR_Y && !LCD_SWAP_XY)

     #define SETPIXEL(x, y, c) _SetPixel(x, y, c)

     #define GETPIXEL(x, y) _GetPixel(x,y)

     #define XORPIXEL(x, y) XorPixel(x,y)

     #elif (!LCD_MIRROR_X && !LCD_MIRROR_Y && LCD_SWAP_XY)

     #define SETPIXEL(x, y, c) _SetPixel(y, x, c)

     #define GETPIXEL(x, y) _GetPixel(y, x)

     #define XORPIXEL(x, y) XorPixel(y, x)

     #elif (!LCD_MIRROR_X && LCD_MIRROR_Y && !LCD_SWAP_XY)

     #define SETPIXEL(x, y, c) _SetPixel(x, LCD_YSIZE-1-(y), c)

     #define GETPIXEL(x, y) _GetPixel(x, LCD_YSIZE-1-(y))

     #define XORPIXEL(x, y) XorPixel (x, LCD_YSIZE-1-(y))

     #elif (!LCD_MIRROR_X && LCD_MIRROR_Y && LCD_SWAP_XY)

     #define SETPIXEL(x, y, c) _SetPixel(LCD_YSIZE-1-(y), x, c)

     #define GETPIXEL(x, y) _GetPixel(LCD_YSIZE-1-(y), x)

     #define XORPIXEL(x, y) XorPixel(LCD_YSIZE-1-(y), x)

     #elif ( LCD_MIRROR_X && !LCD_MIRROR_Y && !LCD_SWAP_XY)

     #define SETPIXEL(x, y, c) _SetPixel(LCD_XSIZE-1-(x), y, c)

     #define GETPIXEL(x, y) _GetPixel(LCD_XSIZE-1-(x), y)

     #define XORPIXEL(x, y) XorPixel (LCD_XSIZE-1-(x), y)

     #elif ( LCD_MIRROR_X && !LCD_MIRROR_Y && LCD_SWAP_XY)

     #define SETPIXEL(x, y, c) _SetPixel(LCD_YSIZE-1-(y), x, c)

     #define GETPIXEL(x, y) _GetPixel(LCD_YSIZE-1-(y), x)

     #define XORPIXEL(x, y) XorPixel(LCD_YSIZE-1-(y), x)

     #elif ( LCD_MIRROR_X && LCD_MIRROR_Y && !LCD_SWAP_XY)

     #define SETPIXEL(x, y, c) _SetPixel(LCD_XSIZE-1-(x), LCD_YSIZE-1-(y), c)

     #define GETPIXEL(x, y) _GetPixel(LCD_XSIZE-1-(x), LCD_YSIZE-1-(y))

     #define XORPIXEL(x, y) XorPixel (LCD_XSIZE-1-(x), LCD_YSIZE-1-(y))

     #elif ( LCD_MIRROR_X && LCD_MIRROR_Y && LCD_SWAP_XY)

     #error This combination of mirroring/swapping not yet supported

     #endif

    #elif (LCD_SUPPORT_COMTRANS && !LCD_SUPPORT_SEGTRANS)

     #if (!LCD_SWAP_XY)

     #define SETPIXEL(x, y, c) _SetPixel(x,LCD__aLine2Com0[y], c)

     #define GETPIXEL(x, y) _GetPixel(x,LCD__aLine2Com0[y])

     #define XORPIXEL(x, y) XorPixel(x,LCD__aLine2Com0[y])

     #else

     #define SETPIXEL(x, y, c) _SetPixel(y,LCD__aLine2Com0[x], c)

     #define GETPIXEL(x, y) _GetPixel(y,LCD__aLine2Com0[x])

     #define XORPIXEL(x, y) XorPixel(y,LCD__aLine2Com0[x])

     #endif

    #elif (!LCD_SUPPORT_COMTRANS && LCD_SUPPORT_SEGTRANS)

     #if (!LCD_SWAP_XY)

     #define SETPIXEL(x, y, c) _SetPixel(LCD__aRow2Seg0[x],y, c)

     #define GETPIXEL(x, y) _GetPixel(LCD__aRow2Seg0[x],y)

     #define XORPIXEL(x, y) XorPixel(LCD__aRow2Seg0[x],y)

     #else

     #define SETPIXEL(x, y, c) _SetPixel(LCD__aRow2Seg0[y],x, c)

     #define GETPIXEL(x, y) _GetPixel(LCD__aRow2Seg0[y],x)

     #define XORPIXEL(x, y) XorPixel(LCD__aRow2Seg0[y],x)

     #endif

    #elif (LCD_SUPPORT_COMTRANS && LCD_SUPPORT_SEGTRANS)

     #if (!LCD_SWAP_XY)

     #define SETPIXEL(x, y, c)

    _SetPixel(LCD__aRow2Seg0[x],LCD__aLine2Com0[y], c)

     #define GETPIXEL(x, y)

    _GetPixel(LCD__aRow2Seg0[x],LCD__aLine2Com0[y])

     #define XORPIXEL(x, y)

    XorPixel(LCD__aRow2Seg0[x],LCD__aLine2Com0[y])

     #else

     #define SETPIXEL(x, y, c)

    _SetPixel(LCD__aRow2Seg0[y],LCD__aLine2Com0[x], c)

     #define GETPIXEL(x, y)

    _GetPixel(LCD__aRow2Seg0[y],LCD__aLine2Com0[x])

     #define XORPIXEL(x, y)

    XorPixel(LCD__aRow2Seg0[y],LCD__aLine2Com0[x])

     #endif

    #else

     #error This combination of switches not yet supported #endif

    #define XY2OFF(x,y) ((x>>3)+y*((LCD_XSIZE_PHYS+7)>>3)) #define BKCOLOR LCD_BKCOLORINDEX

    #define COLOR LCD_COLORINDEX

/*

     *********************************************************

     * *

     * ID translation table *

     * *

     *********************************************************

    This table contains 0, 1, 2, ... and serves as translation table for DDBs

*/

static const U8 TransId[] = { 0,1 };

/*

     *********************************************************

     * *

     * LCD Access *

     * *

     ********************************************************* */

int LCD_Adr;

#if (!LCD_CHECKBUSY)

     #define LCD_WAIT()

    #endif

    static U8 result; /* Possibly needed for access macro */

/*

     *********************************************************

     * *

     * LCD Access Controller SED133x *

     * *

     ********************************************************* */

#if (LCD_CONTROLLER == 1330) \

     ||(LCD_CONTROLLER == 1335)

/* Remap ...A0, ...A1 -> ...CMD, ...DATA */

#define LCD_READCMD0 LCD_READ_A0

    #define LCD_READDATA0 LCD_READ_A1

    #define LCD_WRITECMD0 LCD_WRITE_A1

    #define LCD_WRITEDATA0 LCD_WRITE_A0

#ifndef LCD_EXTENDED_WAIT

     #define LCD_EXTENDED_WAIT 1

    #endif

#ifndef LCD_WAIT

     #define LCD_WAIT() \

     while (!(LCD_READCMD0()&0x40)); \

     while ( LCD_READCMD0()&0x40) ;

    #endif

    #if LCD_EXTENDED_WAIT

Report this document

For any questions or suggestions please email
cust-service@docsford.com