硬件资源:
TFT (9341)
LCD_D0----D7 : PA0---PA7
LCD_RS : PG9
LCD_nOE:PG8
LCD_nWE:PG7
LCD_nCS: PG6
LCD_RESET:PG0
LCD_BL: PH1
CTP (FT6336U)
CTP_SDA:PA14
CTP_SCL:PA13
CTP_INT: PA12
CTP_RST:PA11
LCD 初始化
int32_t main(void)
{
uint8_t *u8FrameBufPtr,*u8OSDFrameBufPtr;
int i;
outpw(REG_CLK_HCLKEN, 0x0527);
outpw(REG_CLK_PCLKEN0, 0);
outpw(REG_CLK_PCLKEN1, 0);
// outpw(REG_SYS_PWRON, (inpw(REG_SYS_PWRON)& ~0x00000004) | 0xFFFFFFF7);
outpw(REG_SYS_REGWPCTL,0x59);
outpw(REG_SYS_REGWPCTL,0x16);
outpw(REG_SYS_REGWPCTL,0x88);
while(!(inpw(REG_SYS_REGWPCTL)&(1<<0)));
sysClearWatchDogTimerCount(); // clear WDT
sysClearWatchDogTimerInterruptStatus();
sysDisableWatchDogTimer(); //close WDT
sysDisableWatchDogTimerReset();
sysDisableCache();
sysFlushCache(I_D_CACHE);
sysEnableCache(CACHE_WRITE_BACK);
sysInitializeUART();
// Configure multi-function pin for LCD interface
//GPG6 (CLK), GPG7 (HSYNC)
outpw(REG_SYS_GPG_MFPL, (inpw(REG_SYS_GPG_MFPL)& ~0xFF000000) | 0x22000000);
//GPG8 (VSYNC), GPG9 (DEN)
outpw(REG_SYS_GPG_MFPH, (inpw(REG_SYS_GPG_MFPH)& ~0xFF) | 0x22);
//DATA pin (8bit)
outpw(REG_SYS_GPA_MFPL, 0x22222222); //GPA0 ~ GPA7 (DATA0~7)
// outpw(REG_SYS_GPA_MFPH, 0x22222222); //GPA8 ~ GPA15 (DATA8~15)
//GPD8~D15 (DATA16~17)
// outpw(REG_SYS_GPD_MFPH, (inpw(REG_SYS_GPD_MFPH)& ~0xFF) | 0x22);
// LCD clock is selected from UPLL and divide to 20MHz
outpw(REG_CLK_DIVCTL1, (inpw(REG_CLK_DIVCTL1) & ~0xFF1F) | 0x1018);
// Init LCD interface for ILI9341 LCD module
vpostLCMInit(DIS_PANEL_ILI9341_MPU80);
// Init MPU80_TFT_8bit
MPU80_TFT_Init();
/* Setup display address */
MPU80_TFT_SetAddress(0, 239, 0, 319);
// Set scale to 1:1
vpostVAScalingCtrl(1, 0, 1, 0, VA_SCALE_INTERPOLATION);
// Set display color depth
vpostSetVASrc(VA_SRC_RGB565);
// Get pointer of video frame buffer
// Note: before get pointer of frame buffer, must set display color depth first
u8FrameBufPtr = vpostGetFrameBuffer();
if(u8FrameBufPtr == NULL)
{
sysprintf("Get buffer error !!\n");
return 0;
}
vpostOSDSetWindow(33, 30, 70, 70);
/* Memory write */
vpostSetOSDSrc(OSD_SRC_RGB565);
u8OSDFrameBufPtr = vpostGetOSDBuffer();
if(u8OSDFrameBufPtr == NULL)
{
sysprintf("Get OSD buffer error !!\n");
return 0;
}
// Set scale to 1:1
vpostOSDScalingCtrl(1, 0, 0);
// Configure overlay function of OSD to display OSD image
vpostOSDSetOverlay(DISPLAY_OSD, DISPLAY_OSD, 0);
// Enable color key function
vpostOSDSetColKey(0, 0, 0);
vpostMPUWriteAddr(0x2c);
最近编辑记录 gary (2018-05-30 15:38:59)
离线
上面是点屏的代码
离线
可以的,加上littleVGL 后编译很多错
离线
楼主你的ILI9341屏在哪里买的?为什么我买到的都是SPI接口的?
离线
9341,7789的屏我以前做产品用过,市场上很多的
离线
CTP是分开的
离线
nuc97x littltVGL DEMO
离线
附件上传了,看不到
离线