|
我参考论坛里的教程修改那几处后,打算先显示一个简单的字符串,没有操作系统,只是显示字符串,但是下载后屏幕全黑,什么也没有。
屏幕是我随便买回来玩的7寸的,时8080时序驱动的,液晶的驱动自己写好的,测试过没问题,修改的代码如下:
- #include "GUI.h"
- #include "GUIDRV_Template.h"
- #include "bsp.h"
- #define XSIZE_PHYS 800
- #define YSIZE_PHYS 480
- #define VXSIZE_PHYS 800
- #define VYSIZE_PHYS 480
- #define COLOR_CONVERSION GUICC_M565
- #define DISPLAY_DRIVER &GUIDRV_Template_API
- #define DISPLAY_ORIENTATION GUI_SWAP_XY | GUI_MIRROR_X | GUI_MIRROR_Y
- void LCD_X_Config(void) {
- GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, COLOR_CONVERSION, 0, 0);
- LCD_SetSizeEx (0, XSIZE_PHYS, YSIZE_PHYS);
- LCD_SetVSizeEx (0, VXSIZE_PHYS, VYSIZE_PHYS);
-
- }
- static void _SetPixelIndex(GUI_DEVICE * pDevice, int x, int y, int PixelIndex) {
- #ifdef WIN32
- LCDSIM_SetPixelIndex(x, y, PixelIndex, pDevice->LayerIndex);
- #else
- #if (LCD_MIRROR_X == 1) || (LCD_MIRROR_Y == 1) || (LCD_SWAP_XY == 1)
- int xPhys, yPhys;
- xPhys = LOG2PHYS_X(x, y);
- yPhys = LOG2PHYS_Y(x, y);
- #else
- #define xPhys x
- #define yPhys y
- #endif
- GUI_USE_PARA(pDevice);
- GUI_USE_PARA(x);
- GUI_USE_PARA(y);
- GUI_USE_PARA(PixelIndex);
- {
- //
- // Write into hardware ... Adapt to your system
- //
- // TBD by customer...
- //
- YJ_SetPoint(xPhys,yPhys,PixelIndex);
- }
- #if (LCD_MIRROR_X == 0) && (LCD_MIRROR_Y == 0) && (LCD_SWAP_XY == 0)
- #undef xPhys
- #undef yPhys
- #endif
- #endif
- }
- static unsigned int _GetPixelIndex(GUI_DEVICE * pDevice, int x, int y) {
- unsigned int PixelIndex;
- #ifdef WIN32
- PixelIndex = LCDSIM_GetPixelIndex(x, y, pDevice->LayerIndex);
- #else
- #if (LCD_MIRROR_X == 1) || (LCD_MIRROR_Y == 1) || (LCD_SWAP_XY == 1)
- int xPhys, yPhys;
- xPhys = LOG2PHYS_X(x, y);
- yPhys = LOG2PHYS_Y(x, y);
- #else
- #define xPhys x
- #define yPhys y
- #endif
- GUI_USE_PARA(pDevice);
- GUI_USE_PARA(x);
- GUI_USE_PARA(y);
- {
- //
- // Write into hardware ... Adapt to your system
- //
- // TBD by customer...
- PixelIndex = YJ_ReadPonit(xPhys, yPhys);
- }
- #if (LCD_MIRROR_X == 0) && (LCD_MIRROR_Y == 0) && (LCD_SWAP_XY == 0)
- #undef xPhys
- #undef yPhys
- #endif
- #endif
- return PixelIndex;
- }
复制代码 主要修改了这三个函数和代码优化的那几个,然后写了一个字符串显示的函数,
- void MainTask(void)
- {
- int xPos;
- int yPos;
- int xSize;
- int i;
- i = 0;
-
- /* ³õʼ»¯ */
- GUI_Init();
-
- /* »ñȡҪÏÔʾµÄX,Y×ø±ê */
- xPos = LCD_GetXSize() / 2;
- yPos = LCD_GetYSize() / 3;
-
- /* ÉèÖÃÎı¾ÏÔʾģʽ */
- GUI_SetTextMode(GUI_TM_REV);
-
- /* ÉèÖÃÏÔʾ×ÖÌå */
- GUI_SetFont(GUI_FONT_20F_ASCII);
- GUI_DispStringHCenterAt("Hello world!", xPos, yPos);
-
- /* ÉèÖÃÏÔʾÊý×Ö×ÖÌå */
- GUI_SetFont(GUI_FONT_D24X32);
- /* »ñÈ¡ÏÔʾ0000£¬ÔÚ×ÖÌåGUI_FONT_D24X32ϵÄÏÔʾÇé¿ö */
- xSize = GUI_GetStringDistX("0000");
-
- /* ÉèÖÃÏÔʾλÖà */
- xPos -= xSize / 2;
- yPos += 24 + 10;
- while (1)
- {
- GUI_DispDecAt( i++, xPos, yPos, 4);
- if (i > 9999)
- {
- i = 0;
- }
- }
- }
复制代码 可是屏幕就是不亮,什么也不显示,我测试又了一下液晶,液晶没坏,求助啊 |
|