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

📄 lcdmemc.lst

📁 Keil C下通过的UCGUI,UCGUI的移植源代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
              };
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *       Macros for internal use                         *
                      *                                                       *
                      *********************************************************
              */
              
              #if (LCD_SUPPORT_COMTRANS)
                #if (LCD_MIRROR_Y)
                  #error LCD_MIRROR_Y not supported with COMTrans !
                #endif
                #if (LCD_MIRROR_X)
                  #error LCD_MIRROR_X not supported with COMTrans !
                #endif
              #endif
              
              #if (!LCD_SUPPORT_COMTRANS && !LCD_SUPPORT_SEGTRANS)
                #if   (!LCD_MIRROR_X && !LCD_MIRROR_Y && !LCD_SWAP_XY) 
                  #define SETPIXEL(x, y, c)      SETPIXELPHYS        ((x), (y), (c))
                  #define SETPIXELFAST(x, y, c)  SETPIXELPHYS        ((x), (y), (c))
                  #define GETPIXEL(x, y)         GetPixel            ((x), (y))
                  #define XORPIXEL(x, y)         XorPixel            ((x), (y))
C51 COMPILER V8.05a   LCDMEMC                                                              04/11/2008 14:19:25 PAGE 6   

                #elif (!LCD_MIRROR_X && !LCD_MIRROR_Y &&  LCD_SWAP_XY) 
                  #define SETPIXEL(x, y, c)      SETPIXELPHYS        ((y), (x), (c))
                  #define SETPIXELFAST(x, y, c)  SETPIXELPHYS        ((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)      SETPIXELPHYS        ((x), (LCD_YSIZE-1-(y)), (c))
                  #define SETPIXELFAST(x, y, c)  SETPIXELPHYS        ((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)      SETPIXELPHYS        ((LCD_YSIZE-1-(y)), (x), (c))
                  #define SETPIXELFAST(x, y, c)  SETPIXELPHYS        ((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)      SETPIXELPHYS        ((LCD_XSIZE-1-(x)), (y), (c))
                  #define SETPIXELFAST(x, y, c)  SETPIXELPHYS        ((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)      SETPIXELPHYS        ((y), (LCD_XSIZE-1-(x)), (c))
                  #define SETPIXELFAST(x, y, c)  SETPIXELPHYS        ((y), (LCD_XSIZE-1-(x)), (c))
                  #define GETPIXEL(x, y)         GetPixel            ((y), (LCD_XSIZE-1-(x)))
                  #define XORPIXEL(x, y)         XorPixel            ((y), (LCD_XSIZE-1-(x)))
                #elif ( LCD_MIRROR_X &&  LCD_MIRROR_Y && !LCD_SWAP_XY) 
                  #define SETPIXEL(x, y, c)      SETPIXELPHYS        ((LCD_XSIZE-1-(x)), (LCD_YSIZE-1-(y)), (c))
                  #define SETPIXELFAST(x, y, c)  SETPIXELPHYS        ((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)      SetPixelPhys(x,LCD__aLine2Com0[y], c)
                  #define SETPIXELFAST(x, y, c)  SETPIXELPHYS(x,LCD__aLine2Com0[y], c)
                  #define GETPIXEL(x, y)     LCD_L0_GetPixelIndex(x,LCD__aLine2Com0[y])
                  #define XORPIXEL(x, y)      XorPixel(x,LCD__aLine2Com0[y])
                #else
                  #define SETPIXEL(x, y, c)      SetPixelPhys(y,LCD__aLine2Com0[x], c)
                  #define SETPIXELFAST(x, y, c)  SETPIXELPHYS(y,LCD__aLine2Com0[x], c)
                  #define GETPIXEL(x, y)     LCD_L0_GetPixelIndex(y,LCD__aLine2Com0[x])
                  #define XORPIXEL(x, y)      XorPixel(y,LCD__aLine2Com0[x])
                #endif
              #else
                #error This combination of switches not yet supported
              #endif
              
              #define XY2OFF(x,y) (y*LCD_BYTESPERLINE+3*(x>>3))
              
              #ifndef WIN32
                #if   (LCD_BITSPERPIXEL == 3)
                  #define OFF2PTR(Off) &LCD_VRam[0][Off]
                #elif (LCD_BITSPERPIXEL == 6)
                  #define OFF2PTR_0(Off) &LCD_VRam_0[Off]
                  #define OFF2PTR_1(Off) &LCD_VRam_1[Off]
                #endif
              #else
                #if   (LCD_BITSPERPIXEL == 3)
                  #define OFF2PTR(Off) (pVRam+Off)
                #elif (LCD_BITSPERPIXEL == 6)
C51 COMPILER V8.05a   LCDMEMC                                                              04/11/2008 14:19:25 PAGE 7   

                  #define OFF2PTR_0(Off) (pVRam_0+Off)
                  #define OFF2PTR_1(Off) (pVRam_1+Off)
                #endif
              #endif
              
              
              
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *       Internal set pixel routines                     *
                      *                                                       *
                      *********************************************************
              */
              
              #if (LCD_BITSPERPIXEL == 3)
              
              #define SETPIXELPHYS(x,y,c)                       \
              {                                                 \
                 U8 LCD_VRAMTYPE* p = OFF2PTR(XY2OFF(x,y));     \
                switch (x&7) {                                  \
                case 0:                                         \
                  *p = (*p&~(7<<5))|(c<<5);                     \
                  break;                                        \
                case 1:                                         \
                  *p = (*p&~(7<<2))|(c<<2);                     \
                  break;                                        \
                case 2:                                         \
                  *p   = (*p&~(3))|(c>>1);                      \
                  p++;                                          \
                  *p = (*p &~(1<<7))|(c<<7);                    \
                  break;                                        \
                case 3:                                         \
                  p++;                                          \
                  *p = (*p&~(7<<4))|(c<<4);                     \
                  break;                                        \
                case 4:                                         \
                  p++;                                          \
                  *p = (*p&~(7<<1))|(c<<1);                     \
                  break;                                        \
                case 5:                                         \
                  p++;                                          \
                  *p   = (*p&~(1))|(c>>2);                      \
                  p++;                                          \
                  *p = (*p &~(3<<6))|(c<<6);                    \
                  break;                                        \
                case 6:                                         \
                  p+=2;                                         \
                  *p = (*p&~(7<<3))|(c<<3);                     \
                  break;                                        \
                case 7:                                         \
                  p+=2;                                         \
                  *p = (*p&~(7<<0))|(c);                        \
                  break;                                        \
                }                                               \
              }
              
              #elif (LCD_BITSPERPIXEL == 6)
              
              void SetPixelPhys222(int x, int y, LCD_PIXELINDEX c) {
C51 COMPILER V8.05a   LCDMEMC                                                              04/11/2008 14:19:25 PAGE 8   

                U8 LCD_VRAMTYPE* p0 = OFF2PTR_0(XY2OFF(x,y));
                U8 LCD_VRAMTYPE* p1 = OFF2PTR_1(XY2OFF(x,y));
                U8 c0 = ((c & 0x20) >> 3) + ((c & 0x08) >> 2) + ((c & 0x02) >> 1);
                U8 c1 = ((c & 0x10) >> 2) + ((c & 0x04) >> 1) +  (c & 0x01);
                switch (x&7) {
                case 0:
                  *p0 = (*p0&~(7<<5))|(c0<<5);
                  *p1 = (*p1&~(7<<5))|(c1<<5);
                  break;
                case 1:
                  *p0 = (*p0&~(7<<2))|(c0<<2);
                  *p1 = (*p1&~(7<<2))|(c1<<2);
                  break;
                case 2:
                  *p0   = (*p0&~(3))|(c0>>1);
                  *p1   = (*p1&~(3))|(c1>>1);
                  p0++;
                  p1++;
                  *p0 = (*p0 &~(1<<7))|(c0<<7);
                  *p1 = (*p1 &~(1<<7))|(c1<<7);
                  break;
                case 3:
                  p0++;
                  p1++;
                  *p0 = (*p0&~(7<<4))|(c0<<4);
                  *p1 = (*p1&~(7<<4))|(c1<<4);
                  break;
                case 4:
                  p0++;
                  p1++;
                  *p0 = (*p0&~(7<<1))|(c0<<1);
                  *p1 = (*p1&~(7<<1))|(c1<<1);
                  break;
                case 5:
                  p0++;
                  p1++;
                  *p0   = (*p0&~(1))|(c0>>2);
                  *p1   = (*p1&~(1))|(c1>>2);
                  p0++;
                  p1++;
                  *p0 = (*p0 &~(3<<6))|(c0<<6);
                  *p1 = (*p1 &~(3<<6))|(c1<<6);
                  break;
                case 6:
                  p0+=2;
                  p1+=2;
                  *p0 = (*p0&~(7<<3))|(c0<<3);
                  *p1 = (*p1&~(7<<3))|(c1<<3);
                  break;
                case 7:
                  p0+=2;
                  p1+=2;
                  *p0 = (*p0&~(7<<0))|(c0);
                  *p1 = (*p1&~(7<<0))|(c1);
                  break;
                }
              }
              
              #define SETPIXELPHYS(x,y,c) SetPixelPhys222(x,y,c) 
              
              #endif
              
C51 COMPILER V8.05a   LCDMEMC                                                              04/11/2008 14:19:25 PAGE 9   

              static void SetPixelPhys(int x, int y, LCD_PIXELINDEX c) {
                SETPIXELPHYS(x,y,c);
              }
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *       Next pixel routines, optimized for 3bpp
                      *                                                       *
                      *********************************************************
              */
              
              #if      (LCD_OPTIMIZE)             \
                    && (!LCD_MIRROR_X)            \
                    && (!LCD_MIRROR_Y)            \
                    && (!LCD_SWAP_XY)             \
                    && (!LCD_SUPPORT_COMTRANS)    \
                    && (!LCD_SUPPORT_SEGTRANS)    \
                    && (LCD_BITSPERPIXEL == 3)
              
              static int CurPosX;
              static U8 LCD_VRAMTYPE* pCurPos;
              
              static void SetPosXY(int x, int y) {
                CurPosX = x;
                pCurPos = OFF2PTR(XY2OFF(x,y));
                switch (x&7) {
                case 3:
                case 4:
                case 5:
                  pCurPos++; break;
                case 6:
                case 7:
                  pCurPos+=2;
                }
              }
              
              static void SetNextPixel(LCD_PIXELINDEX c) {
                switch (CurPosX&7) {
                case 0: *pCurPos = (*pCurPos&~(7<<5))|(c<<5); break;
                case 1: *pCurPos = (*pCurPos&~(7<<2))|(c<<2); break;
                case 2: *pCurPos = (*pCurPos&~(3))|(c>>1);
                         pCurPos++;
                        *pCurPos = (*pCurPos &~(1<<7))|(c<<7);
                         break;
                case 3: *pCurPos = (*pCurPos&~(7<<4))|(c<<4); break;
                case 4: *pCurPos = (*pCurPos&~(7<<1))|(c<<1); break;
                case 5: *pCurPos = (*pCurPos&~(1))|(c>>2);
                         pCurPos++;
                        *pCurPos = (*pCurPos &~(3<<6))|(c<<6);
                         break;
                case 6: *pCurPos = (*pCurPos&~(7<<3))|(c<<3); break;
                case 7: *pCurPos = (*pCurPos&~(7<<0))|(c);
                         pCurPos++;
                         break;
                }
                CurPosX++;
              }
              
              /*
                      *********************************************************
C51 COMPILER V8.05a   LCDMEMC                                                              04/11/2008 14:19:25 PAGE 10  

                      *                                                       *
                      *       Next pixel routines, optimized for 6bpp
                      *                                                       *
                      *********************************************************
              */
              
              #elif    (LCD_OPTIMIZE)             \
                    && (!LCD_MIRROR_X)            \
                    && (!LCD_MIRROR_Y)            \
                    && (!LCD_SWAP_XY)             \

⌨️ 快捷键说明

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