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

📄 lcdslin.lst

📁 Keil C下通过的UCGUI,UCGUI的移植源代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
              
                LCD_WRITEDATA(LCD_XSIZEB);    /* SetGraphArea */
                LCD_WRITEDATA(LCD_XSIZEB>>8);
                LCD_WRITECMD(0x43);
              }
              
              
              /* LCD_FirstInit */
              void LCD_FirstInit(void) {
                int i;
                LCD_INIT_CONTROLLER();
                LCD_SETADR(0);
                for (i=0; i<100; i++) {
                  LCD_WRITE1(0xff);
                }
                LCD_SETADR(0);
                for (i=0;i<LCD_RAMSIZE;i++) {
                  LCD_WRITE1(0x0);
                }
              }
              
              #endif /* T6963 */
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *       Write 1 byte and manage cache                   *
                      *                                                       *
                      *********************************************************
              */
              
              static void LCD_Write(int Adr, U8 Byte) {
                if (Cache[Adr]!=Byte) {
                  Cache[Adr]=Byte;
                  if (LCD_Adr!=Adr) {
                    LCD_SETADR(Adr);
                  }
                  LCD_WRITE1(Byte);
                }
C51 COMPILER V8.05a   LCDSLIN                                                              04/11/2008 14:19:26 PAGE 11  

              }
              
              #define LCD_WRITE(Adr,Byte) LCD_Write(Adr,Byte);
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *       Internal set pixel routines                     *
                      *                                                       *
                      *********************************************************
              */
              
              static void _SetPixel(int x, int y, LCD_PIXELINDEX c) {
                U8 Mask=1<<(7-(x&7));
                int Adr=XY2OFF(x,y);
                U8 CacheByte=Cache[Adr];
                if (c)
                  CacheByte|= Mask;
                else
                  CacheByte&=~Mask;
                LCD_WRITE(Adr,CacheByte)
              }
              
              static PIXELCOLOR _GetPixel(int x, int y) {
                int Adr=XY2OFF(x,y);
                U8 Mask=1<<(7-(x&7));
                return (Cache[Adr]&Mask) ? 1 : 0;
              }
              
              static void XorPixel   (int x, int y) {
                LCD_PIXELINDEX Index = _GetPixel(x,y);
                _SetPixel(x,y, LCD_NUM_COLORS-1-Index);
              }
              
              /*
                      *********************************************************
                      *                                                       *
                      *       LCD_L0_SetPixelIndex                            *
                      *                                                       *
                      *********************************************************
              
              Purpose:  This routine is called by emWin. It writes 1 pixel into the
                        display.
              
              */
              
              void LCD_L0_SetPixelIndex(int x, int y, int ColorIndex) {
                SETPIXEL(x, y, ColorIndex);
              }
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *       LCD_L0_XorPixel                                 *
                      *                                                       *
                      *********************************************************
              
              Purpose:  This routine is called by emWin. It writes 1 pixel into the
                        display.
              
C51 COMPILER V8.05a   LCDSLIN                                                              04/11/2008 14:19:26 PAGE 12  

              */
              
              void LCD_L0_XorPixel(int x, int y) {
                XORPIXEL(x, y);
              }
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *          LCD_L0_DrawHLine optimized                   *
                      *                                                       *
                      *********************************************************
              */
              
              #if (LCD_OPTIMIZE)               \
                    && (!LCD_SWAP_XY)          \
                    && (!LCD_MIRROR_X)         \
                    && (!LCD_MIRROR_Y)         \
                    && (!LCD_SUPPORT_COMTRANS) \
                    && (!LCD_SUPPORT_SEGTRANS)
              
              void LCD_L0_DrawHLine  (int x0, int y,  int x1) {
                register int Off = XY2OFF(x0,y);
                int iByte = x0>>3;
                int Byte1 = x1>>3;
                U8 Mask =    0xff   >> (x0&7);
                U8 EndMask = 0xff80 >> (x1&7);
                U8 Data;
                if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
                  for (; iByte<Byte1; iByte++) {
                    Data = Cache[Off];
                    Data ^= Mask; 
                    LCD_WRITE(Off++,Data);
                    Mask = 0xff;
                  }
                  Mask &= EndMask;
                  Data = Cache[Off];
                  Data ^= Mask; 
                  LCD_WRITE(Off++,Data);
                } else {                                  /* Clear pixels in line */
                  int NumBytes = Byte1-iByte;
                  if (COLOR==0) {
                    if (NumBytes) {
                      Data = Cache[Off] & (~Mask);
                      LCD_WRITE(Off++,Data);
                      NumBytes--;
                    /* Fill bytes in 2 loops for speed reasons ... */
                      for (; NumBytes>=4; NumBytes-=4) {
                        LCD_WRITE(Off++,0);
                        LCD_WRITE(Off++,0);
                        LCD_WRITE(Off++,0);
                        LCD_WRITE(Off++,0);
                      }
                      for (; NumBytes; NumBytes--) {
                        LCD_WRITE(Off++,0);
                      }
                      Mask = 0xff;
                    }
                    Mask &= EndMask;
                    Data = Cache[Off];
                    Data &= ~Mask; 
C51 COMPILER V8.05a   LCDSLIN                                                              04/11/2008 14:19:26 PAGE 13  

                    LCD_WRITE(Off++,Data);
                  } else {                                  /* Set pixels in line */
                    if (NumBytes) {
                      Data = Cache[Off] | Mask; 
                      LCD_WRITE(Off++,Data);
                      NumBytes--;
                    /* Fill bytes in 2 loops for speed reasons ... */
                      for (; NumBytes>=4; NumBytes-=4) {
                        LCD_WRITE(Off++,0xff);
                        LCD_WRITE(Off++,0xff);
                        LCD_WRITE(Off++,0xff);
                        LCD_WRITE(Off++,0xff);
                      }
                      for (; NumBytes; NumBytes--) {
                        LCD_WRITE(Off++,0xff);
                      }
                      Mask = 0xff;
                    }
                    Mask &= EndMask;
                    Data = Cache[Off] | Mask; 
                    LCD_WRITE(Off++,Data);
                  }
                }
              }
              
              #else
              
              /*
                      *********************************************************
                      *                                                       *
                      *          LCD_L0_DrawHLine unoptimized                 *
                      *                                                       *
                      *********************************************************
              */
              
              void LCD_L0_DrawHLine  (int x0, int y,  int x1) {
                if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
                  while (x0 <= x1) {
                    XORPIXEL(x0, y);
                    x0++;
                  }
                } else {
                  while (x0 <= x1) {
                    SETPIXEL(x0, y, COLOR);
                    x0++;
                  }
                }
              }
              
              #endif
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *          LCD_L0_DrawVLine                             *
                      *                                                       *
                      *********************************************************
              */
              
              void LCD_L0_DrawVLine  (int x, int y0,  int y1) {
                if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
C51 COMPILER V8.05a   LCDSLIN                                                              04/11/2008 14:19:26 PAGE 14  

                  while (y0 <= y1) {
                    XORPIXEL(x, y0);
                    y0++;
                  }
                } else {
                  while (y0 <= y1) {
                    SETPIXEL(x, y0, COLOR);
                    y0++;
                  }
                }
              }
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *          LCD_FillRect, unoptimized                    *
                      *                                                       *
                      *********************************************************
              */
              
              void LCD_L0_FillRect(int x0, int y0, int x1, int y1) {
                for (; y0 <= y1; y0++) {
                  LCD_L0_DrawHLine(x0,y0, x1);
                }
              }
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *    Support for dynamic inversion of entire LCD        *
                      *                                                       *
                      *********************************************************
              
              */
              
              #if LCD_REVERSEMODE_SUPPORT
              
              void LCD_SetNormalDispMode    (void) {
              }
              void LCD_SetReverseDispMode   (void) {
              }
              
              #endif
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *          Draw Bitmap 1 BPP, optimized                 *
                      *                                                       *
                      *********************************************************
              */
              
              #if (LCD_OPTIMIZE)               \
                    && (!LCD_SWAP_XY)          \
                    && (!LCD_MIRROR_X)         \
                    && (!LCD_MIRROR_Y)         \
                    && (!LCD_SUPPORT_COMTRANS) \
                    && (!LCD_SUPPORT_SEGTRANS)
              
C51 COMPILER V8.05a   LCDSLIN                                                              04/11/2008 14:19:26 PAGE 15  

              static void  DrawBitLine1BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
                LCD_PIXELINDEX Index0 = *(pTrans+0);

⌨️ 快捷键说明

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