📄 lcd13xx.lst
字号:
#endif
#if (LCD_SWAP_BYTE_ORDER)
#define READ_REG(Off, Data) Data = LCD_READ_REG(Off)
#define WRITE_REG(Off, Data) LCD_WRITE_REG(Off, Data)
#else
#define READ_REG(Off, Data) { Data = Swap(LCD_READ_REG(Off)); }
#define WRITE_REG(Off, Data) { LCD_WRITE_REG(Off, Swap(Data)); }
#define REQUIRE_SWAP
#endif
/* No use of LCD_WRITE_MEM, LCD_READ_MEM, LCD_WRITE_REG, LCD_READ_REG from this point */
#if defined (LCD_LUT_COM)
#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 (!defined(LCD_LUT_SEG))
#if (!LCD_MIRROR_X && !LCD_MIRROR_Y && !LCD_SWAP_XY)
#define PHYS2LOG(x, y) x, y
#elif (!LCD_MIRROR_X && !LCD_MIRROR_Y && LCD_SWAP_XY)
#define PHYS2LOG(x, y) y, x
#elif (!LCD_MIRROR_X && LCD_MIRROR_Y && !LCD_SWAP_XY)
#define PHYS2LOG(x, y) x, LCD_YSIZE - 1 - (y)
#elif (!LCD_MIRROR_X && LCD_MIRROR_Y && LCD_SWAP_XY)
#define PHYS2LOG(x, y) LCD_YSIZE - 1 - (y), x
#elif ( LCD_MIRROR_X && !LCD_MIRROR_Y && !LCD_SWAP_XY)
#define PHYS2LOG(x, y) LCD_XSIZE - 1 - (x), y
#elif ( LCD_MIRROR_X && !LCD_MIRROR_Y && LCD_SWAP_XY)
#define PHYS2LOG(x, y) LCD_YSIZE - 1 - (y), x
#elif ( LCD_MIRROR_X && LCD_MIRROR_Y && !LCD_SWAP_XY)
#define PHYS2LOG(x, y) 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
#else
#define PHYS2LOG(x, y) LCD__aCol2Seg0[x], y
#endif
#define SETPIXEL(x, y, c) _SetPixel (PHYS2LOG(x, y), c)
#define GETPIXEL(x, y) GetPixelIndex(PHYS2LOG(x, y))
#define XORPIXEL(x, y) XorPixel (PHYS2LOG(x, y))
/*
*********************************************************
* *
* Register access routines *
* *
*********************************************************
C51 COMPILER V8.05a LCD13XX 04/11/2008 14:19:22 PAGE 13
*/
#if defined(LCD_READ_REG)
#if (LCD_BUSWIDTH == 8)
#define READ_REG_BYTE(Off) LCD_READ_REG(Off)
#else
#define READ_REG_BYTE(Off) ReadRegByte(Off)
U8 ReadRegByte(int Off) {
U16 Data = LCD_READ_REG((Off>>1));
#if LCD_SWAP_BYTE_ORDER
return (Off&1) ? Data>>8 : Data&255;
#else
return (Off&1) ? Data&255 : Data>>8;
#endif
}
#endif
#endif
/*
*********************************************************
* *
* Static routines
* *
*********************************************************
*/
#ifdef REQUIRE_SWAP
U16 Swap(U16 Data) {
return (Data<<8) | (Data>>8);
}
#endif
/*
*********************************************************
* *
* Next pixel routines *
* *
*********************************************************
*/
#if (LCD_OPTIMIZE) \
&& (LCD_BUSWIDTH == 8) \
&& (!LCD_MIRROR_X) \
&& (!LCD_MIRROR_Y) \
&& (LCD_SWAP_XY) \
&& (!defined (LCD_LUT_COM)) \
&& (!defined (LCD_LUT_SEG)) \
&& (LCD_BITSPERPIXEL == 4)
static int CurPosY; /* Physical x position !!! */
static tOff CurOff;
static void SetPosXY(int x, int y) {
y = LCD_YSIZE-1-y;
CurPosY = y;
CurOff = XY2OFF(y,x);
C51 COMPILER V8.05a LCD13XX 04/11/2008 14:19:22 PAGE 14
}
static void SetNextPixel(LCD_PIXELINDEX c) {
U8 Data;
READ_MEM(CurOff, Data);
if (CurPosY&1) {
Data = (Data & ~(15<<0)) | (c<<0);
CurOff++;
} else {
Data = (Data & ~(15<<4)) | (c<<4);
}
WRITE_MEM(CurOff, Data);
CurPosY++;
}
#elif (LCD_OPTIMIZE) \
&& (LCD_BUSWIDTH == 8) \
&& (!LCD_MIRROR_X) \
&& (!LCD_MIRROR_Y) \
&& (!LCD_SWAP_XY) \
&& (!defined (LCD_LUT_COM)) \
&& (!defined (LCD_LUT_SEG)) \
&& (LCD_BITSPERPIXEL == 4)
static int CurPosX; /* Physical x position !!! */
static tOff CurOff;
static U8 CurData;
static void SetPosXY(int x, int y) {
CurPosX = x;
CurOff = XY2OFF(x,y);
CurData = LCD_READ_MEM(CurOff);
}
#define SETNEXTPIXEL(c) { \
if (CurPosX&1) { \
CurData = (CurData & ~(15<<0)) | (c<<0); \
WRITE_MEM(CurOff, CurData); \
CurOff++; \
READ_MEM(CurOff, CurData); \
} else { \
CurData = (CurData & ~(15<<4)) | (c<<4); \
} \
CurPosX++; \
}
void SetNextPixel(int c) {
SETNEXTPIXEL(c);
}
#define END_SETNEXTPIXEL() if (CurPosX&1) WRITE_MEM(CurOff, CurData);
#else
#define END_SETNEXTPIXEL()
#endif
/*
*********************************************************
* *
* BitBlt access for SED1356/SED13806 *
C51 COMPILER V8.05a LCD13XX 04/11/2008 14:19:22 PAGE 15
* *
*********************************************************
*/
#if LCD_USE_BITBLT \
&& (LCD_BUSWIDTH==16) \
&& (!defined (LCD_LUT_COM)) \
&& (!defined (LCD_LUT_SEG)) \
&& ((LCD_CONTROLLER == 1356)||(LCD_CONTROLLER == 13806))
#if LCD_BITSPERPIXEL == 8
#define BITBLT_SET_DESTINATION(x,y) WRITE_REG(0x108 / 2, (((tOff)y * (tOff)BYTESPERLINE) + x)); \
WRITE_REG(0x10a / 2, (U32)(((tOff)y * (tOff)BYTESPERLINE) + x) >
-> 16)
#define BITBLT_SET_ACTIVE() WRITE_REG(0x100 / 2, 0x0000); WRITE_REG(0x100 / 2, 0x0080)
#elif LCD_BITSPERPIXEL == 16
#define BITBLT_SET_DESTINATION(x,y) WRITE_REG(0x108 / 2, (((tOff)y * (tOff)BYTESPERLINE) + (x << 1))
-); \
WRITE_REG(0x10a / 2, (((tOff)y * (tOff)BYTESPERLINE) + (x << 1))
- >> 16)
#define BITBLT_SET_ACTIVE() WRITE_REG(0x100 / 2, 0x0100); WRITE_REG(0x100 / 2, 0x0180)
#endif
static void WaitForBltEnd(void) {
volatile U16 tmp;
do {
READ_REG(0x100 / 2, tmp);
} while (tmp & 0x80);
READ_REG(0x100000 / 2, tmp); /* dummy read */
}
static void LCD_FillRectBB(int x0, int y0, int x1, int y1) {
LCD_ENABLE_REG_ACCESS(); {
for (;x0 <= x1; x0 += 1024) {
int _y0 = y0;
int _x1 = x1;
if (_x1 > (x0 + 1023)) {
_x1 = x0 + 1023;
}
for (;_y0 <= y1; _y0 += 1024) {
int _y1 = y1;
if (_y1 > (_y0 + 1023)) {
_y1 = _y0 + 1023;
}
BITBLT_SET_DESTINATION(x0, _y0); /* set destination start address
- */
WRITE_REG(0x110 / 2, (_x1 - x0)); /* set width */
WRITE_REG(0x112 / 2, (_y1 - _y0)); /* set height */
WRITE_REG(0x118 / 2, (COLOR)); /* set foreground color */
if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
WRITE_REG(0x102 / 2, 0x0605); /* pattern fill, ~D */
} else {
WRITE_REG(0x102 / 2, 0x0c00); /* solid fill, no ROP */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -