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

📄 lcd07x1.lst

📁 Keil C下通过的UCGUI,UCGUI的移植源代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
                      *********************************************************
              */
              
              #if (LCD_SCHEDULE_CNT !=0)
                static int ScheduleCntRem=LCD_SCHEDULE_CNT;
                #define CHECK_SCHEDULE(PixelCnt)                              \
                        if ((ScheduleCntRem-=(PixelCnt)) <=0) {               \
                          ScheduleCntRem=LCD_SCHEDULE_CNT;                    \
                          LCD_SCHEDULE();                                     \
                        }
              #else
                #define CHECK_SCHEDULE(PixelCnt)
              #endif
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *          Support for Segment/COMLUTs                  *
                      *                                                       *
                      *********************************************************
              */
              
              /* For compatibility with older configs, define defaults */
              #ifndef LCD_SUPPORT_COMTRANS
                #define LCD_SUPPORT_COMTRANS 0
              #endif
C51 COMPILER V8.05a   LCD07X1                                                              04/11/2008 14:19:22 PAGE 6   

              #ifndef LCD_SUPPORT_SEGTRANS
                #define LCD_SUPPORT_SEGTRANS 0
              #endif
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *           Macro calculations                          *
                      *                                                       *
                      *********************************************************
              */
              
              #define LCD_MSB_SHIFT       (8-LCD_LSB_SHIFT)
              
              /* To make life easier, assign physical x/y size */
              #if !LCD_SWAP_XY
                #define LCD_XSIZE_P LCD_XSIZE
                #define LCD_YSIZE_P LCD_YSIZE
                #define LCD_VXSIZE_P LCD_VXSIZE
                #define LCD_VYSIZE_P LCD_VYSIZE
              #else
                #define LCD_XSIZE_P LCD_YSIZE
                #define LCD_YSIZE_P LCD_XSIZE
                #define LCD_VXSIZE_P LCD_VYSIZE
                #define LCD_VYSIZE_P LCD_VXSIZE
              #endif
              
              /* Define number of used coms/segments per controller */
              #define LCD_NUM_SEGS0 (LCD_LASTSEG0-LCD_FIRSTSEG0+1)
              #define LCD_NUM_COMS0 (LCD_LASTCOM0-LCD_FIRSTCOM0+1)
              #if (LCD_NUM_CONTROLLERS >1)
                #define LCD_NUM_SEGS1 (LCD_LASTSEG1-LCD_FIRSTSEG1+1)
                #define LCD_NUM_COMS1 (LCD_LASTCOM1-LCD_FIRSTCOM1+1)
              #endif
              
              /* Define total number of used coms/segments */
              #if (LCD_NUM_CONTROLLERS ==1)
                #define LCD_NUM_SEGS LCD_NUM_SEGS0
                #define LCD_NUM_COMS LCD_NUM_COMS0
              #elif (LCD_NUM_CONTROLLERS ==2)
                #define LCD_NUM_SEGS (LCD_NUM_SEGS0+LCD_NUM_SEGS1)
                #define LCD_NUM_COMS (LCD_NUM_COMS0+LCD_NUM_COMS1)
              #endif
              
              #define LCD_MEMSIZE ((LCD_BITSPERPIXEL*LCD_VXSIZE/LCD_BUSWIDTH)*(LCD_VYSIZE+LCD_NUM_EMPTY_LINES))
              
              #if     LCD_BITSPERPIXEL == 2              /* Add by ELIZ 19 Jan 00 */
                #define BYTESPERLINE (LCD_VXSIZE_P/4)    /* Add by ELIZ 19 Jan 00 */
                #define WORDSPERLINE (LCD_VXSIZE_P/8)    /* Add by ELIZ 19 Jan 00 */
              #elif   LCD_BITSPERPIXEL == 4
                #define BYTESPERLINE (LCD_VXSIZE_P/2)
                #define WORDSPERLINE (LCD_VXSIZE_P/4)
              #elif LCD_BITSPERPIXEL == 8
                #define BYTESPERLINE (LCD_VXSIZE_P)
                #define WORDSPERLINE (LCD_VXSIZE_P/2)
              #elif LCD_BITSPERPIXEL == 15
                #define BYTESPERLINE (LCD_VXSIZE_P*2)
                #define WORDSPERLINE (LCD_VXSIZE_P)
              #else
                #error This colordepth is not supported !!!
              #endif
C51 COMPILER V8.05a   LCD07X1                                                              04/11/2008 14:19:22 PAGE 7   

              
              #define LCD_NUM_PAGES (LCD_NUM_COMS+7)/8
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *      Configuration switch checking                    *
                      *                                                       *
                      *********************************************************
              
              Please be aware that not all configuration errors can be captured !
              
              */
              
              /* Check number of controllers */
              #if ((LCD_NUM_CONTROLLERS >1) || (LCD_NUM_CONTROLLERS <0))
                #error "More than 1 controller not supported by this driver"
              #endif
              
              /* Check if number of segments / coms equals resolution */
              #if (LCD_NUM_SEGS < LCD_XSIZE_P)
              /*  #error Please check segment setup of controller 0 and X/YSIZE !!!*/
              #endif
              #if (LCD_NUM_COMS < LCD_YSIZE_P)
              /*  #error Please check com setup of controller 0 and X/YSIZE !!!*/
              #endif
              
              
              /*
                      *********************************************************
                      *                                                       *
                      * Standard variables for driver                         *
                      *                                                       *
                      *********************************************************
              */
              
              static char CacheLocked =0;
              static char CacheStat   =0;
              static U8 Cache[LCD_NUM_PAGES][LCD_XSIZE_P][2];
              static U8 aCacheDirty[LCD_NUM_PAGES];
              
              #if LCD_WATCHDOG_TRIGGERCNT
                int WatchdogTriggerCnt;
              #endif
              
              #if LCD_SUPPORT_VERIFY
                static int ErrCnt;
                static int ErrStat;
              #endif
              
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *       Macros for internal use                         *
                      *                                                       *
                      *********************************************************
              */
              
              #if (LCD_SUPPORT_COMTRANS)
C51 COMPILER V8.05a   LCD07X1                                                              04/11/2008 14:19:22 PAGE 8   

                #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)  _SetPixel(x, y, c)
                  #define GETPIXEL(x, y)     _GetPixel(x,y)
                  #define XORPIXEL(x, y)     XorPixel(x,y)
                  #define XORPIXEL_DATA(x, y,c)  XorPixel_Data(x,y,c)
                #elif (!LCD_MIRROR_X && !LCD_MIRROR_Y &&  LCD_SWAP_XY) 
                  #define SETPIXEL(x, y, c)  _SetPixel(y, x, c)
                  #define GETPIXEL(x, y)     _GetPixel(y, x)
                  #define XORPIXEL(x, y)      XorPixel(y, x)
                  #define XORPIXEL_DATA(x, y,c)  XorPixel_Data(y,x,c)
                #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))
                  #define XORPIXEL_DATA(x, y,c)  XorPixel_Data(x,LCD_YSIZE-1-(y),c)
                #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)
                  #define XORPIXEL_DATA(x, y,c)  XorPixel_Data(LCD_YSIZE-1-(y),x,c)
                #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)
                  #define XORPIXEL_DATA(x, y,c)  XorPixel_Data(LCD_XSIZE-1-(x),y,c)
                #elif ( LCD_MIRROR_X && !LCD_MIRROR_Y &&  LCD_SWAP_XY) 
                  #error This combination of mirroring/swapping not yet supported
                #elif ( LCD_MIRROR_X &&  LCD_MIRROR_Y && !LCD_SWAP_XY) 
                  #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))
                  #define XORPIXEL_DATA(x, y,c)  XorPixel_Data(LCD_XSIZE-1-(x), LCD_YSIZE-1-(y),c)
                #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)
C51 COMPILER V8.05a   LCD07X1                                                              04/11/2008 14:19:22 PAGE 9   

                  #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
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *       Next pixel routines                             *
                      *                                                       *
                      *********************************************************
              */
              
              #if 0 /* Not yet defined ! */
                   (LCD_OPTIMIZE)             \
                    && (LCD_BUSWIDTH == 8)        \
                    && (LCD_MIRROR_X)             \
                    && (!LCD_MIRROR_Y)            \
                    && (LCD_SWAP_XY)              \
                    && (!LCD_SUPPORT_COMTRANS)    \
                    && (!LCD_SUPPORT_SEGTRANS)    \
                    && (LCD_BITSPERPIXEL == 4)
              
              static int CurPosY;    /* Physical x position !!! */
              static int CurOff;
              
              static void SetPosXY(int x, int y) {
                y = LCD_YSIZE-1-y;
                CurPosY = y;
                CurOff = XY2OFF(y,x);
              }
              
              static void SetNextPixel(PIXELCOLOR c) {
                U8 Data = LCD_READ_MEM(Off);
                if (CurPosY&1) {
                  Data = (Data & ~(15<<0)) | (c<<0);
                  CurOff++;
                } else {
                  Data = (Data & ~(15<<4)) | (c<<4);
                }
                LCD_WRITE_MEM(Off, Data);
                CurPosY++;
              }
              
              #define SETNEXTPIXEL(c) SetNextPixel(c)
              #endif
              
              
              /*
                      *********************************************************
C51 COMPILER V8.05a   LCD07X1                                                              04/11/2008 14:19:22 PAGE 10  

                      *                                                       *
                      *       Palette info                                    *
                      *                                                       *
                      *********************************************************
              
              The following are "sample" palettes. You might have to create
              a table yourself containing the entries corresponding to the
              colors which your LCD can display.

⌨️ 快捷键说明

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