📄 lcd07x1.c
字号:
} else {
/*
without palette
*/
switch (LCD_DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
case 0:
switch (Diff&3) {
case 0:
goto WriteDDPBit0;
case 1:
goto WriteDDPBit1;
case 2:
goto WriteDDPBit2;
default:
goto WriteDDPBit3;
}
case LCD_DRAWMODE_TRANS:
switch (Diff&3) {
case 0:
goto WriteDDPTBit0;
case 1:
goto WriteDDPTBit1;
case 2:
goto WriteDDPTBit2;
default:
goto WriteDDPTBit3;
}
case LCD_DRAWMODE_XOR:
switch (Diff&3) {
case 0:
goto WriteDDPXBit0;
case 1:
goto WriteDDPXBit1;
case 2:
goto WriteDDPXBit2;
default:
goto WriteDDPXBit3;
}
case LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR:
switch (Diff&3) {
case 0:
goto WriteDDPTXBit0;
case 1:
goto WriteDDPTXBit1;
case 2:
goto WriteDDPTXBit2;
default:
goto WriteDDPTXBit3;
}
}
/*
Write without transparency
*/
WriteDDPBit0:
SETPIXEL(x+0, y, (pixels>>6));
if (!--xsize)
return;
WriteDDPBit1:
SETPIXEL(x+1, y, (3&(pixels>>4)));
if (!--xsize)
return;
WriteDDPBit2:
SETPIXEL(x+2, y, (3&(pixels>>2)));
if (!--xsize)
return;
WriteDDPBit3:
SETPIXEL(x+3, y, (3&(pixels)));
if (!--xsize)
return;
pixels = *(++p);
x+=4;
goto WriteDDPBit0;
/*
Write with transparency
*/
WriteDDPTBit0:
if (pixels&(3<<6))
SETPIXEL(x+0, y, (pixels>>6));
if (!--xsize)
return;
WriteDDPTBit1:
if (pixels&(3<<4))
SETPIXEL(x+1, y, (3&(pixels>>4)));
if (!--xsize)
return;
WriteDDPTBit2:
if (pixels&(3<<2))
SETPIXEL(x+2, y, (3&(pixels>>2)));
if (!--xsize)
return;
WriteDDPTBit3:
if (pixels&(3<<0))
SETPIXEL(x+3, y, (3&(pixels)));
if (!--xsize)
return;
pixels = *(++p);
x+=4;
goto WriteDDPTBit0;
/*
Write without transparency, xor
*/
WriteDDPXBit0:
XORPIXEL_DATA(x+0, y, (pixels>>6));
if (!--xsize)
return;
WriteDDPXBit1:
XORPIXEL_DATA(x+1, y, (3&(pixels>>4)));
if (!--xsize)
return;
WriteDDPXBit2:
XORPIXEL_DATA(x+2, y, (3&(pixels>>2)));
if (!--xsize)
return;
WriteDDPXBit3:
XORPIXEL_DATA(x+3, y, (3&(pixels)));
if (!--xsize)
return;
pixels = *(++p);
x+=4;
goto WriteDDPXBit0;
/*
Write with transparency, xor
*/
WriteDDPTXBit0:
if (pixels&(3<<6))
XORPIXEL_DATA(x+0, y, (pixels>>6));
if (!--xsize)
return;
WriteDDPTXBit1:
if (pixels&(3<<4))
XORPIXEL_DATA(x+1, y, (3&(pixels>>4)));
if (!--xsize)
return;
WriteDDPTXBit2:
if (pixels&(3<<2))
XORPIXEL_DATA(x+2, y, (3&(pixels>>2)));
if (!--xsize)
return;
WriteDDPTXBit3:
if (pixels&(3<<0))
XORPIXEL_DATA(x+3, y, (3&(pixels)));
if (!--xsize)
return;
pixels = *(++p);
x+=4;
goto WriteDDPTXBit0;
}
}
#endif
/*
*********************************************************
* *
* Draw Bitmap 4 BPP *
* *
*********************************************************
*/
#if (LCD_MAX_LOG_COLORS > 4)
static void DrawBitLine4BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
PIXELCOLOR pixels;
/*
Jump to right entry point
*/
pixels = *p;
if (LCD_DrawMode & LCD_DRAWMODE_TRANS) {
if ((Diff&1) ==0)
goto WriteTBit0;
goto WriteTBit1;
} else {
if ((Diff&1) ==0)
goto WriteBit0;
goto WriteBit1;
}
/*
Write without transparency
*/
WriteBit0:
SETPIXEL(x+0, y, *(pTrans+(pixels>>4)));
if (!--xsize)
return;
WriteBit1:
SETPIXEL(x+1, y, *(pTrans+(pixels&0xf)));
if (!--xsize)
return;
x+=2;
pixels = *(++p);
goto WriteBit0;
/*
Write with transparency
*/
WriteTBit0:
if (pixels>>4)
SETPIXEL(x+0, y, *(pTrans+(pixels>>4)));
if (!--xsize)
return;
WriteTBit1:
if (pixels&0xf)
SETPIXEL(x+1, y, *(pTrans+(pixels&0xf)));
if (!--xsize)
return;
x+=2;
pixels = *(++p);
goto WriteTBit0;
}
#endif
/*
*********************************************************
* *
* Draw Bitmap 8 BPP (256 colors) *
* *
* Default (no optimization) *
* *
*********************************************************
*/
#if (LCD_MAX_LOG_COLORS > 16)
static void DrawBitLine8BPP(int x, int y, U8 const*p, int xsize, const LCD_PIXELINDEX*pTrans) {
LCD_PIXELINDEX pixel;
if (pTrans) {
if ((LCD_DrawMode & LCD_DRAWMODE_TRANS)==0) {
while (xsize > 0) {
pixel = *p;
SETPIXEL(x+0, y, *(pTrans+pixel));
xsize--; x++; p++;
}
} else { /* Handle transparent bitmap */
while (xsize > 0) {
pixel = *p;
if (pixel)
SETPIXEL(x+0, y, *(pTrans+pixel));
xsize--; x++; p++;
}
}
} else {
if ((LCD_DrawMode & LCD_DRAWMODE_TRANS)==0) {
while (xsize > 0) {
pixel = *p;
SETPIXEL(x+0, y, pixel);
xsize--; x++; p++;
}
} else { /* Handle transparent bitmap */
while (xsize > 0) {
pixel = *p;
if (pixel)
SETPIXEL(x+0, y, pixel);
xsize--; x++; p++;
}
}
}
}
#endif
/*
*********************************************************
* *
* Universal draw Bitmap routine *
* *
*********************************************************
*/
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;
#if (LCD_MAX_LOG_COLORS > 2)
case 2:
DrawBitLine2BPP(x0, i+y0, pData, Diff, xsize, pTrans);
break;
#endif
#if (LCD_MAX_LOG_COLORS > 4)
case 4:
DrawBitLine4BPP(x0, i+y0, pData, Diff, xsize, pTrans);
break;
#endif
#if (LCD_MAX_LOG_COLORS > 16)
case 8:
DrawBitLine8BPP(x0, i+y0, pData, xsize, pTrans);
break;
#endif
}
pData += BytesPerLine;
}
}
/*
*********************************************************
* *
* LCD_L0_SetOrg *
* *
*********************************************************
Purpose: Sets the original position of the virtual display.
Has no function at this point with the PC-driver.
*/
int OrgX, OrgY;
void LCD_L0_SetOrg(int x, int y) {
OrgX = x;
OrgY = y;
}
/*
*********************************************************
* *
* LCD_On *
* LCD_Off *
* *
*********************************************************
*/
void LCD_Off (void) {
#ifdef LCD_OFF
LCD_OFF();
#endif
}
void LCD_On (void) {
#ifdef LCD_ON
LCD_ON();
#endif
}
/*
*********************************************************
* *
* LCD_L0_ControlCache *
* *
*********************************************************
*/
void LCD_FlushCache(void) {
int page;
for (page=0; page < (LCD_COMS_MAX+7)/8; page++) {
if (aCacheDirty[page]) {
aCacheDirty[page]=0;
SetPage(page);
SetCol(0);
LCD_WRITEMDATA(&Cache[page][0][0], 2*LCD_NUM_SEGS0);
}
}
ColCache = LCD_NUM_SEGS0;
}
U8 LCD_L0_ControlCache(U8 cmd) {
switch (cmd) {
case LCD_CC_LOCK: /* Set Cache to lock state.*/
CacheLocked =1;
break;
case LCD_CC_UNLOCK: /* Set Cache to unlock state ... must flush !*/
CacheLocked =0;
case LCD_CC_FLUSH: /* Flush cache */
if (CacheStat) {
CacheStat =0;
LCD_FlushCache();
}
}
return CacheStat;
}
/*
*********************************************************
* *
* LCD_L0_ReInit : Re-Init the display *
* *
*********************************************************
ReInit contains all of the code that can be re-executed at any point without
changing or even disturbing what can be seen on the LCD.
Note that it is also used as a subroutine by LCD_Init().
*/
void LCD_L0_ReInit(void) {
LCD_Init(); /* Recall LCD init */
}
/*
*********************************************************
* *
* LCD_Init : Init the display *
* *
*********************************************************
*/
#define ZEROINIT(var) memset(&var,0,sizeof(var))
int LCD_L0_Init(void) {
#if LCD_WATCHDOG_TRIGGERCNT
WatchdogTriggerCnt =0;
#endif
#if LCD_SUPPORT_CACHECONTROL
CacheStat =0; /* 0: No changes */
CacheLocked =0; /* 0: Not locked */
#endif
ZEROINIT(Cache);
memset(aCacheDirty,1, sizeof(aCacheDirty));
LCD_INIT_CONTROLLER();
LCD_FlushCache();
return 0; /* Init successfull ! */
}
/*
*********************************************************
* *
* LCD_L0_CheckInit *
* *
* Check if display controller(s) is/are still *
* properly initialized *
* *
*********************************************************
Return value: 0 => No error, init is O.K.
*/
#if LCD_SUPPORT_CHECKINIT
char LCD_L0_CheckInit(void) {
return 0;
}
#endif
#else
void LCD07X1(void) { } /* avoid empty object files */
#endif /* Right LCD_CONTROLLER */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -