原子哥求助 , 我在stm32f103RCT6上移植了emwin_518_keil4_m3,初始化是可以的,显示一个矩形也可以,但是现实字符串和画圆的时候总是啥都没有,还有就是我的TFT控制器是R61509V,是2.8寸240*400
下面是我得部分代码:
这是主函数初始化,可以显示后面的蓝色矩形,但是没有字符串显示
[mw_shl_code=c,true]RCC->APB2ENR |= 0x00000001;/*?????????±??*/
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);/*??±?JTAG,±???SW????*/
IIC_Init();
Delay_Init();
// LCD_Setup();
// LCD_Clear_Area(20 , 40 , 239 , 400 , 0xf800);
// if(LCD_GetPoint(30 , 50)==0xf800)
// {
// GPIOA->BRR=GPIO_Pin_8;
// }
GUI_Init();
GUI_SetBkColor(GUI_LIGHTGRAY);
GUI_Clear();
GUI_SetBkColor(GUI_BLUE);
GUI_ClearRect(10 , 40 , 100 , 70);
GUI_SetColor(GUI_RED);
GUI_DispStringAt("Hello" , 100 , 100);
while(1);[/mw_shl_code]
[mw_shl_code=c,true]下面是初始化的图片,有那个蓝色的矩形,但是没字符串[/mw_shl_code]
下面的是我的TFT驱动,卖家给的是排针对下,从左到右的竖屏显示驱动,我在软件中把他切为了横屏从左到右
[mw_shl_code=c,true]void LCD_Setup(void)
{
LCD_ConfigOutput();
LCD_WriteReg(0x0000, 0x0000);
LCD_WriteReg(0x0000, 0x0000);
LCD_WriteReg(0x0000, 0x0000);
LCD_WriteReg(0x0000, 0x0000);
Delay_Ms(15);
LCD_WriteReg(0x0400, 0x6200);
LCD_WriteReg(0x0008, 0x0808);
//gamma
LCD_WriteReg(0x0300, 0x0C00);
LCD_WriteReg(0x0301, 0x5A0B);
LCD_WriteReg(0x0302, 0x0906);
LCD_WriteReg(0x0303, 0x1017);
LCD_WriteReg(0x0304, 0x2300);
LCD_WriteReg(0x0305, 0x1700);
LCD_WriteReg(0x0306, 0x6309);
LCD_WriteReg(0x0307, 0x0C09);
LCD_WriteReg(0x0308, 0x100C);
LCD_WriteReg(0x0309, 0x2232);
LCD_WriteReg(0x0010, 0x0016); //69.5Hz 0016
LCD_WriteReg(0x0011, 0x0101);
LCD_WriteReg(0x0012, 0x0000);
LCD_WriteReg(0x0013, 0x0001);
LCD_WriteReg(0x0100, 0x0330); //BT,AP
LCD_WriteReg(0x0101, 0x0237); //DC0,DC1,VC
LCD_WriteReg(0x0103, 0x0D00); //VDV
LCD_WriteReg(0x0280, 0x6100); //VCM
LCD_WriteReg(0x0102, 0xC1B0); //VRH,VCMR,PSON,PON
Delay_Ms(50);
LCD_WriteReg(0x0001, 0x0100);
LCD_WriteReg(0x0002, 0x0100);
LCD_WriteReg(0x0003, 0x1030); //1030
LCD_WriteReg(0x0009, 0x0001);
LCD_WriteReg(0x000C, 0x0000);
LCD_WriteReg(0x0090, 0x8000);
LCD_WriteReg(0x000F, 0x0000);
LCD_WriteReg(0x0210, 0x0000);
LCD_WriteReg(0x0211, 0x00EF);
LCD_WriteReg(0x0212, 0x0000);
LCD_WriteReg(0x0213, 0x018f); //432=01AF,400=018F
LCD_WriteReg(0x0500, 0x0000);
LCD_WriteReg(0x0501, 0x0000);
LCD_WriteReg(0x0502, 0x005F);
LCD_WriteReg(0x0401, 0x0001);
LCD_WriteReg(0x0404, 0x0000);
Delay_Ms(50);
LCD_WriteReg(0x0007, 0x0100); //BASEE
Delay_Ms(50);
LCD_WriteReg(0x0200, 0x0000);
LCD_WriteReg(0x0201, 0x0000);
LCD_WriteCmd(0x0202);
Delay_Ms(50);
GPIOA->BSRR=GPIO_Pin_8;
Delay_Ms(50);
}
//////下面是官方文档中需要的函数部分
/*获取一个点,EMWIN官方需要的一个函数*/
uint16_t LCD_GetPoint(u8 Xpos , u16 Ypos)
{
uint16_t color=0;
Ypos=400-Ypos;
LCD_WriteReg(0x0200 , Xpos);
LCD_WriteReg(0x0201 , Ypos);
LCD_WriteCmd(0x0202);
SetWr;
/* Read 16-bit Reg */
SetRs;
ClrRd;
SetRd;
color = GPIOB->IDR;
color = GPIOB->IDR;
SetCs;
return color;
}
/*设置一个点*/
void LCD_SetPoint(u8 Xpos, u16 Ypos, uint16_t Color)
{
Ypos=400-Ypos;
LCD_WriteReg(0x0200 , Xpos);
LCD_WriteReg(0x0201 , Ypos);
LCD_WriteCmd(0x0202);
ClrCs;
SetRs;
SetRd;
GPIOB->ODR=Color;
ClrWr;
SetWr;
SetCs;
}
/*清空一片颜色区域*/
void LCD_Clear_Area(u8 xspos , u16 yspos , u8 xepos , u16 yepos , uint16_t Color)
{
u16 i=0 , j=0;
LCD_WriteReg(0x0210 , xspos);
LCD_WriteReg(0x0211 , xepos);
LCD_WriteReg(0x0212 , 400-yepos);
LCD_WriteReg(0x0213 , 400-yspos);
LCD_WriteReg(0x0200 , xspos);
LCD_WriteReg(0x0201 , 400-yepos);
LCD_WriteCmd(0x0202);
ClrCs;
SetRs;
SetRd;
GPIOB->ODR=Color;
for(i=0;i<xepos-xspos;i++)
{
for(j=0;j<yepos-yspos;j++)
{
ClrWr;
SetWr;
}
}
SetCs;
}[/mw_shl_code]
下面是lcdConfig.c里面的东西
[mw_shl_code=c,true]#define XSIZE_PHYS 240
#define YSIZE_PHYS 400
#define VXSIZE_PHYS 240
#define VYSIZE_PHYS 400
#define COLOR_CONVERSION GUICC_M565
#define DISPLAY_DRIVER GUIDRV_COMPACT_COLOR_16
#define LCD_SWAP_XY 1
/*********************************************************************
* Configuration checking
*********************************************************************/
#ifndef XSIZE_PHYS
#error Physical X size of display is not defined!
#endif
#ifndef YSIZE_PHYS
#error Physical Y size of display is not defined!
#endif
#ifndef VXSIZE_PHYS
#define VXSIZE_PHYS XSIZE_PHYS
#endif
#ifndef VYSIZE_PHYS
#define VYSIZE_PHYS YSIZE_PHYS
#endif
#ifndef COLOR_CONVERSION
#error Color conversion not defined!
#endif
#ifndef DISPLAY_DRIVER
#error No display driver defined!
#endif
#ifndef LCD_SWAP_XY
#define LCD_SWAP_XY 0
#endif
#if LCD_SWAP_XY
#define LCD_XSIZE YSIZE_PHYS
#define LCD_YSIZE XSIZE_PHYS
#else
#define LCD_XSIZE XSIZE_PHYS
#define LCD_YSIZE YSIZE_PHYS
#endif
#define LCD_VXSIZE LCD_XSIZE
#define LCD_VYSIZE LCD_YSIZE
static void _InitController(void)
{
// LCD_SSD1289_SSD1298_Init();
LCD_Setup();
}
void LCD_X_Config(void)
{
/* Set display driver and color conversion */
GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, COLOR_CONVERSION, 0, 0);
LCD_SetSizeEx (0, LCD_XSIZE, LCD_YSIZE);
LCD_SetVSizeEx(0, LCD_VXSIZE, LCD_VYSIZE);
#if(GUI_SUPPORT_TOUCH)
GUI_TOUCH_SetOrientation(0);
//GUI_TOUCH_Calibrate(GUI_COORD_X, 0, XSIZE_PHYS-1, 120, 4750);
// GUI_TOUCH_Calibrate(GUI_COORD_Y, 0, YSIZE_PHYS-1, 160, 4870);
GUI_TOUCH_Calibrate(0, 0xf, 0x131, 0x240, 0xdf4);
GUI_TOUCH_Calibrate(1, 0xf, 0xe1, 0x257, 0xde4);
#endif
}[/mw_shl_code]
这是GUIconfig的东西
[mw_shl_code=c,true]define GUI_NUMBYTES 1024*10
//
// Define the average block size
//
#define GUI_BLOCKSIZE 0x80
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* GUI_X_Config
*
* Purpose:
* Called during the initialization process in order to set up the
* available memory for the GUI.
*/
void GUI_X_Config(void) {
//
// 32 bit aligned memory area
//
static U32 aMemory[GUI_NUMBYTES / 4];
//
// Assign memory to emWin
//
GUI_ALLOC_AssignMemory(aMemory, GUI_NUMBYTES);
GUI_ALLOC_SetAvBlockSize(GUI_BLOCKSIZE);
}
[/mw_shl_code]
|