📄 lcd44b0.c
字号:
SetPixel(x+0, y, *(pTrans+(pixels>>6))); if (!--xsize) return;WriteBit1: SetPixel(x+1, y, *(pTrans+(3&(pixels>>4)))); if (!--xsize) return;WriteBit2: SetPixel(x+2, y, *(pTrans+(3&(pixels>>2)))); if (!--xsize) return;WriteBit3: SetPixel(x+3, y, *(pTrans+(3&(pixels)))); if (!--xsize) return; pixels = *(++p); x+=4; goto WriteBit0;/* Write with transparency*/WriteTBit0: if (pixels&(3<<6)) SetPixel(x+0, y, *(pTrans+(pixels>>6))); if (!--xsize) return;WriteTBit1: if (pixels&(3<<4)) SetPixel(x+1, y, *(pTrans+(3&(pixels>>4)))); if (!--xsize) return;WriteTBit2: if (pixels&(3<<2)) SetPixel(x+2, y, *(pTrans+(3&(pixels>>2)))); if (!--xsize) return;WriteTBit3: if (pixels&(3<<0)) SetPixel(x+3, y, *(pTrans+(3&(pixels)))); if (!--xsize) return; pixels = *(++p); x+=4; goto WriteTBit0;}#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) { U8 pixels;/*// Jump to right entry point*/ pixels = *p; if (GUI_Context.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) * * * **********************************************/#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 ((GUI_Context.DrawMode & LCD_DRAWMODE_TRANS)==0) { if (pTrans) { for (;xsize > 0; xsize--,x++,p++) { pixel = *p; SetPixel(x, y, *(pTrans+pixel)); } } else { for (;xsize > 0; xsize--,x++,p++) { SetPixel(x, y, *p); } } } else { /* Handle transparent bitmap */ if (pTrans) { for (; xsize > 0; xsize--, x++, p++) { pixel = *p; if (pixel) { SetPixel(x+0, y, *(pTrans+pixel)); } } } else { for (; xsize > 0; xsize--, x++, p++) { pixel = *p; if (pixel) { SetPixel(x+0, y, pixel); } } } }}#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; 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) {}void LCD_On (void) { Delay(100); // rPDATG = ( rPDATG & (~(1<<5)) ); rGPBDAT = (rGPBDAT&(~(1<<2))); Delay(100);}void LCD_Init_Controler() { frameBuffer256=(U32 (*)[SCR_XSIZE/4])LCDFRAMEBUFFER; //frameBuffer256=(U32 (*)[SCR_XSIZE])LCDFRAMEBUFFER; rLCDCON1=(CLKVAL_CSTN<<8)|(MVAL_USED<<7)|(2<<5)|(3<<1)|0; // 8-bit single scan,8bpp CSTN,ENVID=off rLCDCON2=(0<<24)|(LINEVAL_CSTN<<14)|(0<<6)|(0<<0); rLCDCON3=(WDLY_CSTN<<19)|(HOZVAL_CSTN<<8)|(LINEBLANK_CSTN<<0); rLCDCON4=(MVAL<<8)|(WLH_CSTN<<0); rLCDCON5=0; //BPP24BL:x,FRM565:x,INVVCLK:x,INVVLINE:x,INVVFRAME:x,INVVD:x, //INVVDEN:x,INVPWREN:x,INVLEND:x,PWREN:x,ENLEND:x,BSWP:x,HWSWP:x rLCDSADDR1=(((U32)frameBuffer256>>22)<<21 )|M5D((U32)frameBuffer256>>1); rLCDSADDR2=M5D( ((U32)frameBuffer256+(SCR_XSIZE_CSTN*LCD_YSIZE_CSTN/1))>>1 ); rLCDSADDR3=(((SCR_XSIZE_CSTN-LCD_XSIZE_CSTN)/2)<<11)|(LCD_XSIZE_CSTN/2); rDITHMODE=0x0; rREDLUT =0xfdb96420; rGREENLUT=0xfdb96420; rBLUELUT =0xfb40; }unsigned int LCD_L0_GetPixelIndex(int x, int y) { return GetPixelIndex(x,y);}/*********************************************************** ** LCD_L0_SetLUTEntry ** ***********************************************************/void LCD_L0_SetLUTEntry(U8 Pos, LCD_COLOR color) {}/*********************************************************** ** LCD_L0_ReInit : Re-Init the display ** **********************************************************ReInit contains all of the code that can be re-executed at any point withoutchanging 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_Controler(); /* macro defined in config */}/*********************************************************** ** LCD_Init : Init the display ** ***********************************************************/int LCD_L0_Init(void) { GUI_DEBUG_LOG("\nLCD_Init()"); /* Init controllers (except lookup table) */ LCD_L0_ReInit(); LCD_Off(); 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.*/int LCD_L0_CheckInit(void) { return 0;}#elsevoid LCD13XX(void) { } /* avoid empty object files */#endif /* (LCD_CONTROLLER == 0) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -