📄 lcd44b0.c
字号:
// Init_data(0x0021,(y<<8)|x), Init_data(0x0020,x); Init_data(0x0021,y); Init_data4(0x0022,PixelIndex); frameBuffer[y][x]=PixelIndex; }/*********************************************** LCD_L0_GetPixelIndex***********************************************Purpose: Returns the index of the given pixel. The upper layers of emWin calling this routine make sure that the coordinates are in range, so that no check on the parameters needs to be performed.*/unsigned int LCD_L0_GetPixelIndex(int x, int y) { return(frameBuffer[y][x]); }/*********************************************** LCD_L0_XorPixel************************************************/void LCD_L0_XorPixel(int x, int y) { LCD_PIXELINDEX PixelIndex = LCD_L0_GetPixelIndex(x, y); LCD_L0_SetPixelIndex(x, y, LCD_NUM_COLORS - PixelIndex - 1);}/*********************************************** LCD_L0_DrawHLine************************************************/void LCD_L0_DrawHLine (int x0, int y, int x1) { if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) { for (; x0 <= x1; x0++) { LCD_L0_XorPixel(x0, y); } } else { for (; x0 <= x1; x0++) { LCD_L0_SetPixelIndex(x0, y, LCD_COLORINDEX); } }}/*********************************************** LCD_L0_DrawVLine************************************************/void LCD_L0_DrawVLine (int x, int y0, int y1) { if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) { for (; y0 <= y1; y0++) { LCD_L0_XorPixel(x, y0); } } else { for (; y0 <= y1; y0++) { LCD_L0_SetPixelIndex(x, y0, LCD_COLORINDEX); } }}/*********************************************** LCD_L0_FillRect************************************************/void LCD_L0_FillRect(int x0, int y0, int x1, int y1) { for (; y0 <= y1; y0++) { LCD_L0_DrawHLine(x0, y0, x1); }}/*********************************************** LCD_L0_DrawBitmap************************************************/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; case 2: _DrawBitLine2BPP(x0, i + y0, pData, Diff, xsize, pTrans); break; case 4: _DrawBitLine4BPP(x0, i + y0, pData, Diff, xsize, pTrans); break; case 8: _DrawBitLine8BPP(x0, i + y0, pData, xsize, pTrans); break; case 16: DrawBitLine16BPP(x0, i + y0, (const U16 *)pData, xsize, pTrans); break; } pData += BytesPerLine; }}/*********************************************** LCD_L0_SetOrg************************************************/void LCD_L0_SetOrg(int x, int y) { GUI_USE_PARA(x); GUI_USE_PARA(y);}/*********************************************** LCD_On / LCD_Off************************************************/void LCD_On (void) {}void LCD_Off (void) {}/*********************************************** LCD_L0_Init***********************************************Purpose: Initialises the LCD-controller.*/int LCD_L0_Init(void) { LCD_INIT_CONTROLLER(); return 0;}/*********************************************** LCD_L0_SetLUTEntry************************************************/void LCD_L0_SetLUTEntry(U8 Pos, LCD_COLOR Color) { GUI_USE_PARA(Pos); GUI_USE_PARA(Color);}//;R-5BIT,G-6BIT,B-5BIT picture width:8,picture heighth:14unsigned char number[][224]={{ /* 0 */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255, 255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,0,0,255,255,255,255,255,255,0,0,255,255,255,255, 255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},{ /* 1 */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255, 255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}, { /* 2 */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,0,0,0,0,0,0,0,0,0,0,255,255, 255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255, 255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255, 255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255, 255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},{ /* 3 */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255, 255,255,0,0,255,255,255,255,255,255,0,0,255,255,255,255, 255,255,0,0,255,255,255,255,255,255,0,0,255,255,255,255, 255,255,255,255,255,255,0,0,0,0,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255, 255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,0,0,255,255,255,255,255,255,0,0,0,0,255,255, 255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},{ /* 4 */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255, 255,255,255,255,255,255,0,0,0,0,255,255,255,255,255,255, 255,255,255,255,0,0,255,255,0,0,255,255,255,255,255,255, 255,255,255,255,0,0,255,255,0,0,255,255,255,255,255,255, 255,255,0,0,255,255,255,255,0,0,255,255,255,255,255,255, 255,255,0,0,0,0,0,0,0,0,0,0,255,255,255,255, 255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},{ /* 5 */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,0,0,0,0,0,0,0,0,0,0,255,255, 255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,0,0,255,255,255,255,255,255,0,0,255,255, 255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 },{ /* 6 */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255, 255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255, 255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255, 255,255,0,0,255,255,0,0,0,0,0,0,255,255,255,255, 255,255,0,0,0,0,255,255,255,255,255,255,0,0,255,255, 255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,255,255,0,0,255,255,255,255,0,0,0,0,255,255, 255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 },{ /* 7 */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,0,0,0,0,0,0,0,0,0,0,255,255,255,255, 0,0,255,255,255,255,255,255,255,255,0,0,255,255,255,255, 255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255, 255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255, 255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255},{ /* 8 */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255, 255,255,0,0,255,255,255,255,255,255,0,0,255,255,255,255, 255,255,0,0,255,255,255,255,255,255,0,0,255,255,255,255, 255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255, 255,255,0,0,255,255,255,255,255,255,0,0,255,255,255,255, 255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255, 255,255,0,0,255,255,255,255,255,255,0,0,0,0,255,255, 255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, },{ /* 9 */ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255, 0,0,255,255,255,255,255,255,255,255,0,0,255,255,255,255, 0,0,255,255,255,255,255,255,255,255,0,0,255,255,255,255, 0,0,255,255,255,255,255,255,255,255,0,0,255,255,255,255, 255,255,0,0,0,0,0,0,0,0,0,0,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255, 255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255, 255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}};unsigned int lcd_ic_id(void){ unsigned long int id_value;//(*(volatile unsigned short *) (lcd_BASE_ADDRESS +0x0))=0x00>>8;(*(volatile unsigned short *) (lcd_BASE_ADDRESS +0x0))=0x00;//Init_data2(0x00);//Init_data2(0x00); id_value=((*(volatile unsigned short *) (lcd_BASE_ADDRESS+0x04)));id_value= ((id_value>>2)&0xff00)|((id_value>>1)&0x00ff); return(id_value);}void display_id(unsigned int x,unsigned int y,unsigned int id_value){ int i; for(i=0;i<4;i++) display_num(x+i*8,y,number[(id_value>>(12-i*4))&0xf]);}void display_num(unsigned int x,unsigned int y,unsigned char *pic){ int i,j; for(j=0;j<14;j++) for(i=0;i<8;i++) { Init_data2(0x0020); // Init_data2(0x21); Init_data1(x+i); Init_data2(0x0021); // Init_data2(0x21); Init_data1(y+j); //Init_data1((x+i)); Init_data2(0x0022); // Init_data2(0x22); Init_data1(((*pic++)<<8)|(*pic++)); // Init_data1(); // Init_data(0x0021); //Init_data(0x0021,0x((y+j)<<8|(x+i))); // Init_data1(0x0022); //Init_data(0x0022,0x(((*pic++)<<8)|(*pic++))); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -