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

📄 lcdslin.lst

📁 Keil C下通过的UCGUI,UCGUI的移植源代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
                  #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) 
C51 COMPILER V8.05a   LCDSLIN                                                              04/11/2008 14:19:26 PAGE 6   

                  #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 };
              
              
              /*
C51 COMPILER V8.05a   LCDSLIN                                                              04/11/2008 14:19:26 PAGE 7   

                      *********************************************************
                      *                                                       *
                      *       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
                #define LCD_WRITECMD(cmd)      { LCD_WAIT(); LCD_WRITECMD0(cmd);  }
                #define LCD_WRITEDATA(Data)    { LCD_WAIT(); LCD_WRITEDATA0(Data);}
              #else
                #define LCD_WRITECMD(cmd)      { LCD_WRITECMD0(cmd);  }
                #define LCD_WRITEDATA(Data)    { LCD_WRITEDATA0(Data);}
              #endif
              
              #define GSTART (0x0)
              #if (LCD_YSIZE_PHYS >128)
                #define TSTART 30000
              #else
                #define TSTART 7000
              #endif
              
              static void LCD_SetSystem(void) {
                LCD_WRITECMD (0x40);
                LCD_WRITEDATA(0x30);                 /* P1                                    */
                LCD_WRITEDATA(0x87);                 /* P2 : FX : hor. char size-1            */
C51 COMPILER V8.05a   LCDSLIN                                                              04/11/2008 14:19:26 PAGE 8   

                LCD_WRITEDATA(0x7);                  /* P3 : FY : ver. char size-1 (not imp.) */
                LCD_WRITEDATA(((LCD_XSIZE_PHYS+7)>>3)-1); /* P4 : Characters per row               */
                LCD_WRITEDATA(0x4a);                 /* P5 : Timing charcters per row         */
                LCD_WRITEDATA(LCD_YSIZE_PHYS-1);          /* P6 : Number of lines per screen       */
                LCD_WRITEDATA((LCD_XSIZE_PHYS+7)>>3);     /* P7 : Address pitch low                */
                LCD_WRITEDATA(0x00);                 /* P8 : Address pitch high               */
              }
              
              static void LCD_SetScroll(int Adr) {
                LCD_WRITECMD(0x44);
                LCD_WRITEDATA(TSTART&255);               /* address of screen 1 (text)            */
                LCD_WRITEDATA(TSTART>>8);
                LCD_WRITEDATA((LCD_YSIZE_PHYS)-1);
                LCD_WRITEDATA(Adr);                  /* address of screen 2 (graphic)         */
                LCD_WRITEDATA(Adr>>8);
                LCD_WRITEDATA((LCD_YSIZE_PHYS)-1);
              }
              
              static void LCD_SetAdr(int Off) {
                LCD_Adr=Off;
                #if (!LCD_EXTENDED_WAIT)
                  LCD_WAIT();
                #endif
                LCD_WRITECMD (0x46);
                LCD_WRITEDATA(Off&255);
                LCD_WRITEDATA(Off>>8);
              }
              
              #define LCD_SETADR(Off) LCD_SetAdr(Off)
              
              static void LCD_Write1(char Byte) {
                #if (!LCD_EXTENDED_WAIT)
                  LCD_WAIT();
                #endif
                LCD_WRITECMD (0x42);
                LCD_WRITEDATA(Byte);
                LCD_Adr++;
              }
              
              #define LCD_WRITE1(Byte) LCD_Write1(Byte)
              
              /* LCD_L0_ReInit */
              void LCD_L0_ReInit(void) {
                int i;
                LCD_INIT_CONTROLLER();
                LCD_SetSystem();
                LCD_SetScroll(GSTART) ;
                LCD_WRITECMD (0x4c);                 /* Set cursor move direction             */
                LCD_WRITECMD (0x5a);                 /* HDOT SCR : Set horiz. scroll position */
                LCD_WRITEDATA(0);
                LCD_WRITECMD (0x5b);                 /* OVLAY                                 */
                LCD_WRITEDATA(1);
                /* Clear display memory */
                LCD_SETADR(0);
                LCD_WRITECMD (0x42);
                #if (LCD_YSIZE_PHYS >128)
                  for (i=0; i<32000; i++)
                #else
                  for (i=0; i<8000; i++)
                #endif
                    LCD_WRITEDATA(0);
                #if (LCD_REVERSE)
C51 COMPILER V8.05a   LCDSLIN                                                              04/11/2008 14:19:26 PAGE 9   

                  LCD_SETADR(GSTART);
                  LCD_WRITECMD (0x42);
                  for (i=GSTART; i<GSTART+((LCD_XSIZE_PHYS+7)>>3)*LCD_YSIZE_PHYS; i++)
                    LCD_WRITEDATA(0xff);
                #endif
                if(COLOR)
                  memset(Cache,0xff,sizeof(Cache));
                else
                  memset(Cache,0x0,sizeof(Cache));
                LCD_WRITECMD (0x59);                 /* Display on                            */
                LCD_WRITEDATA(0x14);                 /* All screens on, curosr off            */
              }
              
              /* LCD_FirstInit */
              static void LCD_FirstInit(void) {
                LCD_L0_ReInit();
              }
              
              #endif /* SED133x */
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *       LCD Access Controller T6963                     *
                      *                                                       *
                      *********************************************************
              */
              
              #if (LCD_CONTROLLER == 6963)
              
              /* Remap ...A0, ...A1 -> ...CMD, ...DATA */
              
              #define LCD_READCMD0    LCD_READ_A1
              #define LCD_READDATA0   LCD_READ_A0
              #define LCD_WRITECMD0   LCD_WRITE_A1
              #define LCD_WRITEDATA0  LCD_WRITE_A0
              
              #ifndef LCD_WAIT
                #define LCD_WAIT() while ((LCD_READ_A1()&3)!=3) /* Do not use LCD_READCMD0 to fix NC30-problem (JE) */
              #endif
              
              #define LCD_WRITECMD(cmd)      { LCD_WAIT(); LCD_WRITECMD0(cmd);  }
              #define LCD_WRITEDATA(Data)    { LCD_WAIT(); LCD_WRITEDATA0(Data);}
              
              /* Access Macros */
              #define LCD_READDATA()        \
                LCD_WRITECMD(0xC5);         \
                return LCD_DATA0;
              
              #define LCD_SETADR(Adr)       \
                LCD_WRITEDATA((U8)Adr);     \
                LCD_WRITEDATA((U8)(Adr>>8));\
                LCD_WRITECMD(0x24);         \
                LCD_Adr=Adr;
              
              #define LCD_WRITE1(Byte)      \
                LCD_WRITEDATA(Byte);        \
                LCD_WRITECMD(0xC0);         \
                LCD_Adr++;
              
              
C51 COMPILER V8.05a   LCDSLIN                                                              04/11/2008 14:19:26 PAGE 10  

              /* LCD_L0_ReInit */
              #define LCD_RAMSIZE (0x2000)
              #define LCD_GSTART  (0x0)
              #define LCD_XSIZEB  ((LCD_XSIZE_PHYS+7)>>3)
              #define LCD_TSTART  (LCD_RAMSIZE-(LCD_XSIZEB)-(LCD_YSIZE_PHYS>>3))
              
              void LCD_L0_ReInit(void) {
                LCD_WRITECMD(0x81);           /* SetModeXor */
              
                LCD_WRITEDATA((U8)LCD_TSTART);/* SetTextAdr */
                LCD_WRITEDATA((U8)(LCD_TSTART>>8));
                LCD_WRITECMD(0x40);
              
                LCD_WRITEDATA(1);             /* SetTextArea */
                LCD_WRITEDATA(1>>8);
                LCD_WRITECMD(0x41);
              
                LCD_WRITECMD(0x9C);           /* SetTextGraph */
              
                LCD_WRITEDATA(LCD_GSTART);    /* SetGraphAdr */
                LCD_WRITEDATA(LCD_GSTART>>8);
                LCD_WRITECMD(0x42);

⌨️ 快捷键说明

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