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

📄 lcd13xx.lst

📁 Keil C下通过的UCGUI,UCGUI的移植源代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
                      BITBLT_SET_ACTIVE();                                              /* engage bitblt engine */
                      WaitForBltEnd();                                                  /* wait for pending blit to end 
             -*/
                    }
                  }
                } LCD_ENABLE_MEM_ACCESS();
              }
              
C51 COMPILER V8.05a   LCD13XX                                                              04/11/2008 14:19:22 PAGE 16  

              static void LCD_DrawBitmap1BPPBB(int x, int y, U8 const*p, int Diff, int xsize, int ysize, int BytesPerLin
             -e, const LCD_PIXELINDEX*pTrans) {
                volatile U16 tmp;
                x+= Diff;
                LCD_ENABLE_REG_ACCESS(); {
                  U16 StartBit = 7 - (Diff & 7);
                  U16 Data = StartBit | ((GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) ? 0x900 : 0x800);
                  int NumWords = ((Diff & 7) + xsize + 15) >> 4;
                  WRITE_REG(0x102 / 2, Data);                                           /* set start bit and operation *
             -/
                  WRITE_REG(0x104 / 2, 0);                                              /* set source start address */
                  BITBLT_SET_DESTINATION(x, y);                                         /* set destination start address
             - */
                  WRITE_REG(0x110 / 2, (xsize - 1));                                    /* set width */
                  WRITE_REG(0x112 / 2, (ysize - 1));                                    /* set height */
                  WRITE_REG(0x114 / 2, (*(pTrans + 0)));                                /* set background color */
                  WRITE_REG(0x118 / 2, (*(pTrans + 1)));                                /* set foreground color  */
                  BITBLT_SET_ACTIVE();                                                  /* engage bitblt engine */
                  do {
                    READ_REG(0x100 / 2, tmp);
                  } while ((tmp & 0x80) == 0);
                  for (;ysize; ysize--, p += BytesPerLine) {
                    U8 const *pLine= p;
                    int i;
                    for (i = NumWords; i; i--, pLine += 2) {
                      do {
                        READ_REG(0x100 / 2, tmp);
                      } while ((tmp & 0x40) == 0x40);
                      WRITE_REG(0x100000 / 2, ((*pLine) | ((*(pLine + 1)) << 8)));      /* write data into FIFO */
                    }
                  }
                  WaitForBltEnd();                                                      /* wait for pending blit to end 
             -*/
                } LCD_ENABLE_MEM_ACCESS();
              }
              
              #endif
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *       Internal set pixel routines                     *
                      *                                                       *
                      *********************************************************
              */
              
              static void _SetPixel(int x, int y, LCD_PIXELINDEX c) {
                tOff Off = XY2OFF(x,y);
              #if LCD_BUSWIDTH == 16
                #if LCD_BITSPERPIXEL == 1
                  U8 BitNo = (~x)&15;
                  U16 Data;
                  READ_MEM(Off, Data);
                  if (c)
                    Data |= c<<BitNo;
                  else
                    Data &= ~(1<<BitNo);      
                  WRITE_MEM(Off, Data);
                #elif LCD_BITSPERPIXEL == 2
                  U16 Data;
                  U8 Shift = 14 - ((x & 7) << 1);
C51 COMPILER V8.05a   LCD13XX                                                              04/11/2008 14:19:22 PAGE 17  

                  READ_MEM(Off, Data);
                  Data = (Data & ~(3 << Shift)) | (c << Shift);
                  WRITE_MEM(Off, Data);
                #elif LCD_BITSPERPIXEL == 4
                  U8 Shift = ((~x)&3)<<2;         /* 12,8,4 or 0 */
                  U16 Data;
                  READ_MEM(Off, Data);
                  Data &= ~(15<<Shift);
                              Data |= c<<Shift;
                  WRITE_MEM(Off, Data);
                #elif LCD_BITSPERPIXEL == 8
                  U16 Data; 
                  READ_MEM(Off, Data);
                  switch (x&1) {
                  case 1:
                    Data = (Data & ~(0xff   )) | (c   );
                    break;
                  case 0:
                    Data = (Data & ~(0xff<<8)) | (c<<8);
                    break;
                  }
                  WRITE_MEM(Off, Data);
                #elif (LCD_BITSPERPIXEL == 15) | (LCD_BITSPERPIXEL == 16)
                  WRITE_MEM(Off, c);
                #else
                  #error unsupported LCD_BITSPERPIXEL
                #endif
              #elif LCD_BUSWIDTH == 8
                #if LCD_BITSPERPIXEL == 1
                  U8 Data;
                  U8 BitNo;
                  READ_MEM(Off, Data);
                  BitNo = 7-(x&7);
                  if (c)
                    Data |= c<<BitNo;
                  else
                    Data &= ~(1<<BitNo);      
                  WRITE_MEM(Off, Data);
                #elif LCD_BITSPERPIXEL == 2
                  U8 Data;
                  READ_MEM(Off, Data);
                  switch (x&3) {
                  case 3:
                    Data = (Data & ~(3<<0)) | (c<<0);
                    break;
                  case 2:
                    Data = (Data & ~(3<<2)) | (c<<2);
                    break;
                  case 1:
                    Data = (Data & ~(3<<4)) | (c<<4);
                    break;
                  case 0:
                    Data = (Data & ~(3<<6)) | (c<<6);
                    break;
                  }
                  WRITE_MEM(Off, Data);
                #elif LCD_BITSPERPIXEL == 4
                  U8 Data;
                  READ_MEM(Off, Data);
                  switch (x&1) {
                  case 1:
                    Data = (Data & ~(15<<0)) | (c<<0);
C51 COMPILER V8.05a   LCD13XX                                                              04/11/2008 14:19:22 PAGE 18  

                    break;
                  case 0:
                    Data = (Data & ~(15<<4)) | (c<<4);
                    break;
                  }
                  WRITE_MEM(Off, Data);
                #elif LCD_BITSPERPIXEL == 8
                  WRITE_MEM(Off, c);
                #else
                  #error TBD
                #endif
              #else
                #error unsupported LCD_BUSWIDTH
              #endif
              }
              
              unsigned int GetPixelIndex(int x, int y) {
                LCD_PIXELINDEX col;
                tOff Off = XY2OFF(x,y);
              #if LCD_BUSWIDTH == 16
                U16 Data;
                READ_MEM(Off,Data);
                #if LCD_BITSPERPIXEL == 1
                  col = (Data >> (15-(x&15))) &1;
                #elif LCD_BITSPERPIXEL == 2
                  col = (Data >> (14-((x&7)<<1))) &3;
                #elif LCD_BITSPERPIXEL == 4
                  col = (Data >> (12-((x&3)<<2))) &15;
                #elif LCD_BITSPERPIXEL == 8
                  col = ((x&1) ==0) ? Data>>8 : Data;
                #elif LCD_BITSPERPIXEL == 15
                  col = Data;
                #elif LCD_BITSPERPIXEL == 16
                  col = Data;
                #endif
              #else
                U8 Data;
                READ_MEM(Off,Data);
                #if LCD_BITSPERPIXEL == 1
                  col = (Data >> (7-(x&7))) &1;
                #elif LCD_BITSPERPIXEL == 2
                  col = (Data >> (6-((x&3)<<1))) &3;
                #elif LCD_BITSPERPIXEL == 4
                  col = (x&1) ? Data&15 : Data>>4;
                #elif LCD_BITSPERPIXEL == 8
                  col = Data;
                #endif
              #endif
                return col;
              }
              
              static void XorPixel   (int x, int y) {
                LCD_PIXELINDEX Index = GetPixelIndex(x,y);
                _SetPixel(x,y,LCD_NUM_COLORS-1-Index);
              }
              
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *       LCD_L0_XorPixel                                 *
C51 COMPILER V8.05a   LCD13XX                                                              04/11/2008 14:19:22 PAGE 19  

                      *                                                       *
                      *********************************************************
              
              Purpose:  This routine is called by emWin. It writes 1 pixel into the
                        display.
              
              */
              
              void LCD_L0_XorPixel(int x, int y) {
                XORPIXEL(x, y);
              }
              
              /*
                      *********************************************************
                      *                                                       *
                      *       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);
              }
              
              
              /*
                      *********************************************************
                      *                                                       *
              

⌨️ 快捷键说明

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