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

📄 lcd444.lst

📁 Keil C下通过的UCGUI,UCGUI的移植源代码
💻 LST
📖 第 1 页 / 共 2 页
字号:
              */
              
              #if (LCD_BITSPERPIXEL > 8)
              static void  DrawBitLine16BPP(int x, int y, U16 const * p, int xsize, const LCD_PIXELINDEX * pTrans) {
                LCD_PIXELINDEX pixel;
                if ((GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) == 0) {
                  if (pTrans) {
                    for (; xsize > 0; xsize--, x++, p++) {
                      pixel = *p;
                      LCD_L0_SetPixelIndex(x, y, *(pTrans + pixel));
                    }
                  } else {
                    for (;xsize > 0; xsize--, x++, p++) {
                      LCD_L0_SetPixelIndex(x, y, *p);
                    }
                  }
                } else {
                  if (pTrans) {
                    for (; xsize > 0; xsize--, x++, p++) {
                      pixel = *p;
                      if (pixel) {
                        LCD_L0_SetPixelIndex(x, y, *(pTrans + pixel));
                      }
                    }
                  } else {
                    for (; xsize > 0; xsize--, x++, p++) {
                      pixel = *p;
                      if (pixel) {
                        LCD_L0_SetPixelIndex(x, y, pixel);
                      }
                    }
                  }
                }
C51 COMPILER V8.05a   LCD444                                                               04/11/2008 14:19:24 PAGE 7   

              }
              #endif
              
              /*********************************************************************
              *
              *       Exported functions
              *
              **********************************************************************
              */
              
              /*********************************************
              *
              *       LCD_L0_SetPixelIndex
              *
              **********************************************
              Purpose:
                Sets the index of the given pixel. The upper layers of emWin
                calling this routine make sure that the coordinates are in range, so
                that no check on the parameters needs to be performed.
              */
              
              void LCD_L0_SetPixelIndex(int x, int y, int PixelIndex) {
                unsigned Off;
                U16 Data;
                /* Convert logical into physical coordinates (Dep. on LCDConf.h) */
                #if LCD_SWAP_XY | LCD_MIRROR_X| LCD_MIRROR_Y
                  int xPhys = LOG2PHYS_X(x, y);
                  int yPhys = LOG2PHYS_Y(x, y);
                #else
                  #define xPhys x
                  #define yPhys y
                #endif
                /* Write into hardware ... Adapt to your system */
                {
                  Off = Y2OFF(yPhys);
                  Off += 3 * x/4;
                  switch (x&3) {
                  case 0:
                    Data = LCD_READ_MEM16(Off);
                    Data &= 0xf000;
                    Data |= PixelIndex;
                    LCD_WRITE_MEM16(Off, Data);
                    break;
                  case 1:;
                    Data = LCD_READ_MEM16(Off);
                    Data &= 0xfff;
                    Data |= (U16)(PixelIndex << 12);
                    LCD_WRITE_MEM16(Off, Data);
                    Off++;
                    Data = LCD_READ_MEM16(Off);
                    Data &= 0xff00;
                    Data |= PixelIndex>>4;
                    LCD_WRITE_MEM16(Off, Data);
                    break;
                  case 2:;
                    Data = LCD_READ_MEM16(Off);
                    Data &= 0xff;
                    Data |= (U16)(PixelIndex << 8);
                    LCD_WRITE_MEM16(Off, Data);
                    Off++;
                    Data = LCD_READ_MEM16(Off);
                    Data &= 0xfff0;
C51 COMPILER V8.05a   LCD444                                                               04/11/2008 14:19:24 PAGE 8   

                    Data |= PixelIndex>>8;
                    LCD_WRITE_MEM16(Off, Data);
                    break;
                  case 3:;
                    Data = LCD_READ_MEM16(Off);
                    Data &= 0xf;
                    Data |= PixelIndex << 4;
                    LCD_WRITE_MEM16(Off, Data);
                    break;
                  }
                  /* ... */
                }
              }
              
              /*********************************************
              *
              *       LCD_L0_GetPixelIndex
              *
              **********************************************
              Purpose:
                Returns the index of the given pixel. The upper layers of emWin
                calling this routine make sure that the coordinates are in range, so
                that no check on the parameters needs to be performed.
              */
              
              unsigned int LCD_L0_GetPixelIndex(int x, int y) {
                LCD_PIXELINDEX PixelIndex;
                U16 Data0, Data1;
                unsigned Off;
                /* Convert logical into physical coordinates (Dep. on LCDConf.h) */
                #if LCD_SWAP_XY | LCD_MIRROR_X| LCD_MIRROR_Y
                  int xPhys = LOG2PHYS_X(x, y);
                  int yPhys = LOG2PHYS_Y(x, y);
                #else
                  #define xPhys x
                  #define yPhys y
                #endif
                /* Write into hardware ... Adapt to your system */
                {
                  Off = Y2OFF(yPhys);
                  Off += 3 * x/4;
                  switch (x&3) {
                  case 0:
                    PixelIndex = LCD_READ_MEM16(Off) & 0xfff;
                    break;
                  case 1:
                    Data0 = LCD_READ_MEM16(Off);
                    Off++;
                    Data1 = LCD_READ_MEM16(Off);
                    PixelIndex  = Data0 >> 12;
                    PixelIndex |= (Data1 & 255) << 4;
                    break;
                  case 2:
                    Data0 = LCD_READ_MEM16(Off);
                    Off++;
                    Data1 = LCD_READ_MEM16(Off);
                    PixelIndex  = Data0 >> 8;
                    PixelIndex |= (Data1 & 15) << 8;
                    break;
                  case 3:
                    PixelIndex = LCD_READ_MEM16(Off);
                    PixelIndex >>= 4;
C51 COMPILER V8.05a   LCD444                                                               04/11/2008 14:19:24 PAGE 9   

                    break;
                  }
                }
                return PixelIndex;
              }
              
              /*********************************************
              *
              *       LCD_L0_XorPixel
              *
              **********************************************
              */
              
              void LCD_L0_XorPixel(int x, int y) {
                LCD_PIXELINDEX PixelIndex = LCD_L0_GetPixelIndex(x, y);
                LCD_L0_SetPixelIndex(x, y, LCD_NUM_COLORS - PixelIndex - 1);
              }
              
              /*********************************************
              *
              *       LCD_L0_DrawHLine
              *
              **********************************************
              */
              
              void LCD_L0_DrawHLine  (int x0, int y,  int x1) {
                if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
                  for (; x0 <= x1; x0++) {
                    LCD_L0_XorPixel(x0, y);
                  }
                } else {
                  for (; x0 <= x1; x0++) {
                    LCD_L0_SetPixelIndex(x0, y, LCD_COLORINDEX);
                  }
                }
              }
              
              /*********************************************
              *
              *       LCD_L0_DrawVLine
              *
              **********************************************
              */
              
              void LCD_L0_DrawVLine  (int x, int y0,  int y1) {
                if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
                  for (; y0 <= y1; y0++) {
                    LCD_L0_XorPixel(x, y0);
                  }
                } else {
                  for (; y0 <= y1; y0++) {
                    LCD_L0_SetPixelIndex(x, y0, LCD_COLORINDEX);
                  }
                }
              }
              
              /*********************************************
              *
              *       LCD_L0_FillRect
              *
              **********************************************
              */
C51 COMPILER V8.05a   LCD444                                                               04/11/2008 14:19:24 PAGE 10  

              
              void LCD_L0_FillRect(int x0, int y0, int x1, int y1) {
                for (; y0 <= y1; y0++) {
                  LCD_L0_DrawHLine(x0, y0, x1);
                }
              }
              
              /*********************************************
              *
              *       LCD_L0_DrawBitmap
              *
              **********************************************
              */
              
              void LCD_L0_DrawBitmap(int x0, int y0,
                                     int xsize, int ysize,
                                     int BitsPerPixel, 
                                     int BytesPerLine,
                                     const U8* pData, int Diff,
                                     const LCD_PIXELINDEX* pTrans)
              {
                int i;
                /* Use _DrawBitLineXBPP */
                for (i=0; i<ysize; i++) {
                  switch (BitsPerPixel) {
                  case 1:
                    _DrawBitLine1BPP(x0, i + y0, pData, Diff, xsize, pTrans);
                    break;
                    case 2:
                      _DrawBitLine2BPP(x0, i + y0, pData, Diff, xsize, pTrans);
                      break;
                    case 4:
                      _DrawBitLine4BPP(x0, i + y0, pData, Diff, xsize, pTrans);
                      break;
                    case 8:
                      _DrawBitLine8BPP(x0, i + y0, pData, xsize, pTrans);
                      break;
                    case 16:
                      DrawBitLine16BPP(x0, i + y0, (const U16 *)pData, xsize, pTrans);
                      break;
                  }
                  pData += BytesPerLine;
                }
              }
              
              /*********************************************
              *
              *       LCD_L0_SetOrg
              *
              **********************************************
              */
              
              void LCD_L0_SetOrg(int x, int y) {
                GUI_USE_PARA(x);
                GUI_USE_PARA(y);
              }
              
              /*********************************************
              *
              *       LCD_On / LCD_Off
              *
              **********************************************
C51 COMPILER V8.05a   LCD444                                                               04/11/2008 14:19:24 PAGE 11  

              */
              
              void LCD_On (void) {
              #ifdef LCD_ON
                LCD_ON();
              #endif
              }
              
              void LCD_Off (void) {
              #ifdef LCD_OFF
                LCD_OFF();
              #endif
              }
              
              /*********************************************
              *
              *       LCD_L0_Init
              *
              **********************************************
              Purpose:
                Initialises the LCD-controller.
              */
              
              int  LCD_L0_Init(void) {
                LCD_INIT_CONTROLLER();
                return 0;
              }
              
              /*********************************************
              *
              *       LCD_L0_SetLUTEntry
              *
              **********************************************
              */
              
              void LCD_L0_SetLUTEntry(U8 Pos, LCD_COLOR Color) {
                GUI_USE_PARA(Pos);
                GUI_USE_PARA(Color);
              }
              
              #else
 651          
 652          void LCD444_c(void) { } /* avoid empty object files */
 653          
 654          #endif /* (LCD_CONTROLLER undefined) */


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =      1    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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