⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd159a.lst

📁 Keil C下通过的UCGUI,UCGUI的移植源代码
💻 LST
📖 第 1 页 / 共 4 页
字号:
C51 COMPILER V8.05a   LCD159A                                                              04/11/2008 14:19:23 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE LCD159A
OBJECT MODULE PLACED IN LCD159A.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\LCDDriver\LCD159A.c LARGE BROWSE MDU_F120 DEBUG OBJECTEXT
                    -END PRINT(.\LCD159A.lst) OBJECT(LCD159A.obj)

line level    source

   1          /*
   2          *********************************************************************************************************
   3          *                                                uC/GUI
   4          *                        Universal graphic software for embedded applications
   5          *
   6          *                       (c) Copyright 2002, Micrium Inc., Weston, FL
   7          *                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
   8          *
   9          *              礐/GUI is protected by international copyright laws. Knowledge of the
  10          *              source code may not be used to write a similar product. This file may
  11          *              only be used in accordance with a license and should not be redistributed
  12          *              in any way. We appreciate your understanding and fairness.
  13          *
  14          ----------------------------------------------------------------------
  15          File        : LCD159A.C
  16          Purpose     : Driver for LCDs using a Seiko Epson SED159A controller
  17          ----------------------------------------------------------------------   
  18          Version-Date---Author-Explanation                                        
  19          ----------------------------------------------------------------------   
  20          1.00b   020204 JE     a) Hardwareinterface routines renamed:
  21                                   ...DATA -> ...A1, ...CMD -> ...A0
  22          1.00a   010926 JE     a) Support for LCD_SWAPXY added
  23          1.00.00 010710 JE     a) Speed optimizations added
  24          0.90.00 010709 JE     a) First release
  25          ---------------------------LIST OF CONFIG SWITCHES--------------------
  26          The following is a list of additional configuration switches for this
  27          driver. These switches might not be listed in the manual, because
  28          the manual mainly covers the general config switches which are
  29          supported by all drivers.
  30          ----------------------------------------------------------------------
  31          define ----------------------Explanation------------------------------
  32          LCD_OPTIMIZE                 Controls the use of optimized routines.
  33                                       If 1, several (speed) optimizations are used.
  34                                       Default: ON (1)
  35          ----------------------------------------------------------------------
  36          Known problems or limitations with current version
  37          ----------------------------------------------------------------------
  38          a) Cache not supported yet, becuse RAM requirement would be 
  39             to large. LCD_CACHE must be set to 0
  40          ----------------------------------------------------------------------
  41          Open issues
  42          ----------------------------------------------------------------------
  43          none
  44          ---------------------------END-OF-HEADER------------------------------
  45          */
  46          
  47          #include <string.h>             /* for memset */
  48          #include <stddef.h>           /* needed for definition of NULL */
  49          #include "gui\Core\LCD_Private.h"      /* private modul definitions & config */
  50          #include "gui\Core\GUI_Private.h"
  51          #include "gui\Core\GUIDebug.h"
  52          #include "gui\LCDDriver\LCD_0.h"            /* Defines for first display */
  53          
  54          #if      (LCD_CONTROLLER == 0x159A) \
C51 COMPILER V8.05a   LCD159A                                                              04/11/2008 14:19:23 PAGE 2   

  55                && (!defined(WIN32) | defined(LCD_SIMCONTROLLER))
              
              
              /*
                      *********************************************************
                      *
                      *           Defaults for config switches
                      *
                      *********************************************************
              
              */
              
              #ifndef LCD_OPTIMIZE
                #define LCD_OPTIMIZE                (1)
              #endif
              
              #ifndef LCD_CACHE
                #define  LCD_CACHE                  (0)
              #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 Byte);
                void SIM_WriteA0C0(U8 Byte);
                U8   SIM_ReadA1C0(void);
                U8   SIM_ReadA0C0(void);
                #define LCD_WRITE_A1(Byte) SIM_WriteA1C0(Byte) 
                #define LCD_WRITE_A0(Byte) SIM_WriteA0C0(Byte)
                #define LCD_READ_A1(Byte)  Byte = SIM_ReadA1C0()
                #define LCD_READ_A0(Byte)  Byte = SIM_ReadA0C0()
              #endif
              
              /*
                      *********************************************************
                      *
                      *          Remap ...A0, ...A1 -> ...CMD, ...DATA
                      *
                      *********************************************************
              */
              
              #define LCD_READCMD0    LCD_READ_A0
              #define LCD_READDATA0   LCD_READ_A1
              #define LCD_WRITECMD0   LCD_WRITE_A0
              #define LCD_WRITEDATA0  LCD_WRITE_A1
              
              /*
                      *********************************************************
                      *
                      *           Macro calculations
                      *
                      *********************************************************
C51 COMPILER V8.05a   LCD159A                                                              04/11/2008 14:19:23 PAGE 3   

              */
              
              /*
                      *********************************************************
                      *
                      *           Configuration switch checking
                      *
                      *********************************************************
              */
              
              #if (LCD_BITSPERPIXEL != 8)
                #error This controller can handle only 8bpp displays
              #endif
              
              /*
                      *********************************************************
                      *
                      *           Macros, standard
                      *
                      *********************************************************
              
              These macros can be found in any LCD-driver as they serve purposes
              that can be found in any class of LCD-driver (Like clipping).
              
              */
              
              #if (!LCD_SWAP_XY) && (!LCD_MIRROR_X) && (!LCD_MIRROR_Y)
                #define LOG2PHYS(x, y) x, y
              #elif (!LCD_SWAP_XY) && (!LCD_MIRROR_X) && (LCD_MIRROR_Y)
                #define LOG2PHYS(x, y) x, LCD_YSIZE_PHYS - 1 - (y)
              #elif (!LCD_SWAP_XY) && (LCD_MIRROR_X) && (!LCD_MIRROR_Y)
                #define LOG2PHYS(x, y) LCD_XSIZE_PHYS - 1 - (x), y
              #elif (!LCD_SWAP_XY) && (LCD_MIRROR_X) && (LCD_MIRROR_Y)
                #define LOG2PHYS(x, y) LCD_XSIZE_PHYS - 1 - (x), LCD_YSIZE_PHYS - 1 - (y)
              #elif (LCD_SWAP_XY) && (!LCD_MIRROR_X) && (!LCD_MIRROR_Y)
                #define LOG2PHYS(x, y) y, x
              #elif (LCD_SWAP_XY) && (LCD_MIRROR_X) && (!LCD_MIRROR_Y)
                #define LOG2PHYS(x, y) y, LCD_XSIZE - 1 - (x)
              #elif (LCD_SWAP_XY) && (!LCD_MIRROR_X) && (LCD_MIRROR_Y)
                #define LOG2PHYS(x, y) LCD_YSIZE - 1 - (y), x
              #elif (LCD_SWAP_XY) && (LCD_MIRROR_X) && (LCD_MIRROR_Y)
                #define LOG2PHYS(x, y) LCD_YSIZE - 1 - (y), LCD_XSIZE - 1 - (x)
              #else
                #error unsupported configuration
              #endif
              
              #define BKCOLOR LCD_BKCOLORINDEX
              #define   COLOR LCD_COLORINDEX
              
              /*
                      *********************************************************
                      *
                      *           Static variables for driver
                      *
                      *********************************************************
              */
              
              #if LCD_CACHE
                static U8 VRam[LCD_YSIZE_PHYS][LCD_XSIZE_PHYS];
              #endif
              
              static int CurrentX, CurrentY, StartPage, StartColumn, RAM_Mode;
C51 COMPILER V8.05a   LCD159A                                                              04/11/2008 14:19:23 PAGE 4   

              
              /*
                      *********************************************************
                      *
                      *           Hardware access
                      *
                      *********************************************************
              */
              
              /*
                      *****************************************
                      *
                      *           Low level macros
                      *
                      *****************************************
              */
              
              #define RAM_WRITE (0x5c)
              #define RAM_READ  (0x5d)
              
              #define INCREMENT_CURSOR() \
                CurrentX++; \
                if (CurrentX >= LCD_XSIZE_PHYS) { \
                  CurrentX = StartColumn; \
                  CurrentY++; \
                  if (CurrentY >= LCD_YSIZE_PHYS) \
                    CurrentY = StartPage; \
                }
              
              #define RESET_CURSOR() \
                CurrentX = StartColumn; \
                CurrentY = StartPage
              
              #define SET_RAMMODE(Mode) \
                RAM_Mode = Mode; \
                LCD_WRITECMD0 (Mode); \
                RESET_CURSOR()
              
              #define PASET(y) \
                RAM_Mode = 0; \
                LCD_WRITECMD0 (0x75); \
                LCD_WRITEDATA0(y); \
                LCD_WRITEDATA0(LCD_YSIZE_PHYS - 1); \
                StartPage = y
                
              #define CASET(x) \
                RAM_Mode = 0; \
                LCD_WRITECMD0 (0x15); \
                LCD_WRITEDATA0(x); \
                LCD_WRITEDATA0(LCD_XSIZE_PHYS - 1); \
                StartColumn = x
              
              #define LCD_ON() \
                LCD_WRITECMD0 (0xaf); \
                SET_RAMMODE(RAM_WRITE)
              
              #define LCD_OFF() \
                LCD_WRITECMD0 (0xae); \
                SET_RAMMODE(RAM_WRITE)
              
              #define DUMMYREAD(Data) \
                LCD_READDATA0(Data)
C51 COMPILER V8.05a   LCD159A                                                              04/11/2008 14:19:23 PAGE 5   

              
              #if (LCD_OPTIMIZE)
                
                #define SET_RECT(x1, y1, x2, y2) \
                  CurrentX = CurrentY = 0xfff; \
                  LCD_WRITECMD0 (0x15); \
                  LCD_WRITEDATA0(x1); \
                  LCD_WRITEDATA0(x2); \
                  LCD_WRITECMD0 (0x75); \
                  LCD_WRITEDATA0(y1); \
                  LCD_WRITEDATA0(y2); \
                  LCD_WRITECMD0 (0x5c)
              
                #define WRITEDATA_DIRECT(Data) \
                  LCD_WRITEDATA0(Data)
              
              #endif
              
              #if LCD_CACHE
              
                #define WRITEDATA(Data) \
                  if (VRam[CurrentX][CurrentY] != Data) { \
                    VRam[CurrentX][CurrentY] = Data; \
                    LCD_WRITEDATA0(Data); \
                  } \
                  INCREMENT_CURSOR()
              
                #define READDATA(Data) \
                  Data = VRam[CurrentX][CurrentY]
              
              #else
              
                #define WRITEDATA(Data) \
                  LCD_WRITEDATA0(Data); \
                  INCREMENT_CURSOR()
              
                #define READDATA(Data) \
                  LCD_READDATA0(Data); \
                  INCREMENT_CURSOR()
              
              #endif
              
              /*
                      *****************************************
                      *
                      *           GotoXY
                      *
                      *****************************************
              */
              
              void GotoXY(int x, int y, int Mode) {
                if ((CurrentX != x) || (CurrentY != y)) {
                  CASET(x);
                  PASET(y);
                }
                if (RAM_Mode != Mode) {
                  SET_RAMMODE(Mode);
                }
              }
              
              #define GOTOXY(x, y, Mode) GotoXY(x, y, Mode)
              
C51 COMPILER V8.05a   LCD159A                                                              04/11/2008 14:19:23 PAGE 6   

              /*
                      *********************************************************
                      *
                      *           Drawing routines, internal
                      *
                      *********************************************************
              */
              
              /*
                      *****************************************
                      *
                      *           SET pixel
                      *
                      *****************************************
              */
              
              static void SetPixel(int x, int y, U8 Color) {
                GOTOXY(x, y, RAM_WRITE);
                WRITEDATA(Color);
              }
              
              /*
                      *****************************************
                      *
                      *           GET pixel
                      *
                      *****************************************
              */
              
              static U8 GetPixel(int x, int y) {
                U8 Color;
                CASET(x);
                PASET(y);
                SET_RAMMODE(RAM_READ);
                DUMMYREAD(Color);
                READDATA(Color);
                return Color;
              }
              
              /*
                      *****************************************
                      *
                      *           XOR pixel
                      *
                      *****************************************
              */
              
              static void XorPixel(int x, int y) {
                U8 Color = GetPixel(x, y);
                Color ^= 0xff;
                SET_RAMMODE(RAM_WRITE);
                WRITEDATA(Color);
              }
              
              /*
                      *********************************************************
                      *
                      *           Access macros for pixel access
                      *
                      *********************************************************
              
              Use only this macros for pixel access
C51 COMPILER V8.05a   LCD159A                                                              04/11/2008 14:19:23 PAGE 7   

              
              */
              
              #define XORPIXEL(x, y) \
                XorPixel(LOG2PHYS(x, y));
              
              #define SETPIXEL(x, y, Color) \
                SetPixel(LOG2PHYS(x, y), Color);
              
              #define GETPIXEL(x, y, Color) \
                Color = GetPixel(LOG2PHYS(x, y));
              
              /*

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -