292302877 发表于 2012-10-11 20:36:09

UCGUI触摸屏,鼠标移到的地方会有拖影

本帖最后由 292302877 于 2012-10-11 21:22 编辑

刚开始搞 UCGUI ,问题见图片,箭头移动过的地方会在屏上留下拖影,不知道有没有遇到过这个问题的朋友?


不知道是不是读屏的颜色函数有问题,还是其它地方的问题,读屏函数


unsigned int LCD_L0_GetPixelIndex(int x, int y)
{
return TFT_GetPoint(x,y);
}



u16 TFT_GetPoint(u16 x,u16 y)
{
TFT_SetCursor(x,y);
#ifdef DeviceCode_7783
    return (LCD_ReadRAM());
#else
    return (TFT_BGR2RGB(LCD_ReadRAM()));
        #endif
}

/****************************************************************************
* 名    称:u16 TFT_BGR2RGB(u16 c)
* 功    能:RRRRRGGGGGGBBBBB 改为 BBBBBGGGGGGRRRRR 格式
* 入口参数:c      BRG 颜色值
* 出口参数:RGB 颜色值
* 说    明:内部函数调用
* 调用方法:
****************************************************************************/
u16 TFT_BGR2RGB(u16 c)
{
u16r, g, b, rgb;

b = (c>>0)& 0x1f;
g = (c>>5)& 0x3f;
r = (c>>11) & 0x1f;

rgb =(b<<11) + (g<<5) + (r<<0);

return( rgb );
}


/*******************************************************************************
* Function Name: LCD_ReadRAM
* Description    : Reads the LCD RAM.
* Input          : None
* Output         : None
* Return         : LCD RAM Value.
*******************************************************************************/
__inline u16 LCD_ReadRAM(void)
{
vu16 dummy;
/* Write 16-bit Index (then Read Reg) */
LCD->LCD_REG = R34; /* Select GRAM Reg */
/* Read 16-bit Reg */
dummy = LCD->LCD_RAM;
return LCD->LCD_RAM;
}




292302877 发表于 2012-10-11 21:19:51

怎么没有人顶啊,自己顶一个{:smile:}

292302877 发表于 2012-10-13 01:02:49

终于找到问题了,是FSMC 时序设置太快了。
// FSMC_NORSRAMTimingInitTypeDefp;

    FSMC_NORSRAMTimingInitTypeDefTiming_read, Timing_write;


/*-- FSMC Configuration ------------------------------------------------------*/
/*----------------------- SRAM Bank 4 ----------------------------------------*/
/* FSMC_Bank1_NORSRAM4 configuration */
//p.FSMC_AddressSetupTime = 0;
//p.FSMC_AddressHoldTime = 0;
//p.FSMC_DataSetupTime = 2;//1
//p.FSMC_BusTurnAroundDuration = 0;
//p.FSMC_CLKDivision = 0;
//p.FSMC_DataLatency = 0;
//p.FSMC_AccessMode = FSMC_AccessMode_A;

Timing_read.FSMC_AddressSetupTime = 5;            
Timing_read.FSMC_DataSetupTime = 5;
Timing_read.FSMC_AccessMode = FSMC_AccessMode_A;   

Timing_write.FSMC_AddressSetupTime = 1;   
Timing_write.FSMC_DataSetupTime = 2;   
Timing_write.FSMC_AccessMode = FSMC_AccessMode_A;



/* Color LCD configuration ------------------------------------
   LCD configured as follow:
      - Data/Address MUX = Disable
      - Memory Type = SRAM
      - Data Width = 16bit
      - Write Operation = Enable
      - Extended Mode = Enable
      - Asynchronous Wait = Disable */
FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM4;
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct =&Timing_read; //&p;
FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &Timing_write;//&p;


FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
注释掉的为原来的设置,原来读点的函数总是读不正确,现在显示触摸正常{:smile:}

624668529 发表于 2013-8-6 10:26:49

我也遇见这个问题了!!!
页: [1]
查看完整版本: UCGUI触摸屏,鼠标移到的地方会有拖影