// ============================================================================ // lcddp_WakeUp // ---------------------------------------------------------------------------- /// Wake the main LCD screen out of sleep mode /// @return #LCDD_ERR_NO, #LCDD_ERR_NOT_OPENED // ============================================================================ PRIVATE LCDD_ERR_T lcddp_WakeUp(VOID) { if (0 == lcdd_MutexGet()) { sxr_Sleep(LCDD_TIME_MUTEX_RETRY); LCDD_TRACE(TSTDOUT, 0, "LCDD: Wakeup while another LCD operation in progress. Sleep %d ticks", LCDD_TIME_MUTEX_RETRY); } if (!g_lcddInSleep) { lcdd_MutexFree(); return LCDD_ERR_NO; } LCDD_TRACE(TSTDOUT, 0, "lcddp_WakeUp: calling hal_GoudaOpen"); hal_GoudaOpen(&g_tgtLcddCfg.config, g_tgtLcddCfg.timings, 0); // Init code sxr_Sleep(100 MS_WAITING); // Delay 50 ms #if 0 LCM_WR_REG(0x0010, 0x0A00); // Exit Sleep/ Standby mode LCM_WR_REG(0x0011, 0x1038); // Set APON,PON,AON,VCI1EN,VC sxr_Sleep(50 MS_WAITING); LCM_WR_REG(0x0007, 0x1017); // Set D1=0, D0=1 #else main_Write_COM(0x11); //Exit Sleep hal_TimDelay(120 MS_WAITING); lcddp_Init(); #endif g_lcddInSleep = FALSE; lcdd_MutexFree(); // Set a comfortable background color to avoid screen flash LCDD_FBW_T frameBufferWin; frameBufferWin.fb.buffer = NULL; frameBufferWin.fb.colorFormat = LCDD_COLOR_FORMAT_RGB_565; frameBufferWin.roi.x=0; frameBufferWin.roi.y=0; if (g_lcddRotate) { frameBufferWin.roi.width = LCDD_DISP_Y; frameBufferWin.roi.height = LCDD_DISP_X; frameBufferWin.fb.width = LCDD_DISP_Y; frameBufferWin.fb.height = LCDD_DISP_X; } else { frameBufferWin.roi.width = LCDD_DISP_X; frameBufferWin.roi.height = LCDD_DISP_Y; frameBufferWin.fb.width = LCDD_DISP_X; frameBufferWin.fb.height = LCDD_DISP_Y; } lcddp_Blit16(&frameBufferWin,frameBufferWin.roi.x,frameBufferWin.roi.y); return LCDD_ERR_NO; }
PRIVATE BOOL lcddp_CheckProductId() { UINT16 productId=0; LCDD_CONFIG_T lcddReadConfig=LCDD_READ_CONFIG; hal_GoudaOpen(&lcddReadConfig.config, lcddReadConfig.timings, 0); sxr_Sleep(20 MS_WAITING); hal_GoudaReadReg(0xda, &productId); #if 0 hal_HstSendEvent(0xff9163C1); hal_HstSendEvent((UINT32)productId); hal_HstSendEvent(0xff9163C1); #endif hal_GoudaReadData(&productId); #if 0 hal_HstSendEvent(0xff9163C2); hal_HstSendEvent((UINT32)productId); hal_HstSendEvent(0xff9163C2); #endif hal_GoudaClose(); SXS_TRACE(TSTDOUT, "ili9163c(0x%x): lcd read id is 0x%x ", LCD_ILI9163C_ID, productId); if(productId == LCD_ILI9163C_ID) return TRUE; else return FALSE; }
// ============================================================================ // lcddp_Open // ---------------------------------------------------------------------------- /// Open the LCDD driver. /// It must be called before any call to any other function of this driver. /// This function is to be called only once. /// @return #LCDD_ERR_NO or #LCDD_ERR_DEVICE_NOT_FOUND. // ============================================================================ PRIVATE LCDD_ERR_T lcddp_Open(VOID) { hal_GoudaOpen(&g_tgtLcddCfg.config, g_tgtLcddCfg.timings, 0); lcddp_Init(); g_lcddInSleep = FALSE; return LCDD_ERR_NO; }
// ============================================================================ // lcddp_Open // ---------------------------------------------------------------------------- /// Open the LCDD driver. /// It must be called before any call to any other function of this driver. /// This function is to be called only once. /// @return #LCDD_ERR_NO or #LCDD_ERR_DEVICE_NOT_FOUND. // ============================================================================ PRIVATE LCDD_ERR_T lcddp_Open(VOID) { hal_GoudaOpen(&g_tgtLcddCfg.config, g_tgtLcddCfg.timings, 0); // Init code sxr_Sleep(50 MS_WAITING); // Delay 50 ms lcddp_Init(); g_lcddInSleep = FALSE; return LCDD_ERR_NO; }
PRIVATE BOOL lcddp_CheckProductId() { UINT16 productId=0; LCDD_CONFIG_T lcddReadConfig=LCDD_READ_CONFIG; hal_GoudaOpen(&lcddReadConfig.config, lcddReadConfig.timings, 0); sxr_Sleep(20 MS_WAITING); hal_GoudaReadReg(0xda, &productId); hal_GoudaClose(); //hal_HstSendEvent(productId); SXS_TRACE(TSTDOUT, "st7735r(0x%x): lcd read id is 0x%x ", LCD_ST7735R_ID, productId); //if((productId&0x0FF) == LCD_ST7735R_ID) return TRUE; //else // return FALSE; }
PRIVATE BOOL lcddp_CheckProductId() { UINT16 productId=0; LCDD_CONFIG_T lcddReadConfig=LCDD_READ_CONFIG; hal_GoudaOpen(&lcddReadConfig.config, lcddReadConfig.timings, 0); sxr_Sleep(20 MS_WAITING); hal_GoudaReadReg(0x0, &productId); hal_GoudaClose(); SXS_TRACE(TSTDOUT, "otm2201h(0x%x): lcd read id is 0x%x ", LCD_OTM2201H_ID, productId); if(productId == LCD_OTM2201H_ID) return TRUE; else return FALSE; }
PRIVATE BOOL lcddp_CheckProductId() { UINT16 productId=0; LCDD_CONFIG_T lcddReadConfig=LCDD_READ_CONFIG; hal_GoudaOpen(&lcddReadConfig.config, lcddReadConfig.timings, 0); sxr_Sleep(20 MS_WAITING); hal_GoudaReadReg(0x93, &productId); hal_GoudaClose(); SXS_TRACE(TSTDOUT, "hx8340b(0x%x): lcd read id is 0x%x ", LCD_HX8340B_ID, productId); hal_HstSendEvent(0x1cd00004); hal_HstSendEvent(productId); if(productId == LCD_HX8340B_ID) return TRUE; else return FALSE; }
PRIVATE BOOL lcddp_CheckProductId() { UINT16 productId=0; LCDD_CONFIG_T lcddReadConfig=LCDD_READ_CONFIG; hal_GoudaOpen(&lcddReadConfig.config, lcddReadConfig.timings, 0); sxr_Sleep(20 MS_WAITING); hal_GoudaReadReg(0x0, &productId); hal_GoudaClose(); SXS_TRACE(TSTDOUT, "ili9225br(0x%x): lcd read id is 0x%x ", LCD_ILI9225B_ID, productId); #ifdef TGT_GALLITE_G800 return TRUE; #else if(productId == LCD_ILI9225B_ID) return TRUE; else return FALSE; #endif }
// ============================================================================ // lcdd_Open // ---------------------------------------------------------------------------- /// Open the LCDD driver. /// It must be called before any call to any other function of this driver. /// This function is to be called only once. /// @return #LCDD_ERR_NO or #LCDD_ERR_DEVICE_NOT_FOUND. // ============================================================================ PUBLIC LCDD_ERR_T lcdd_Open(VOID) { UINT32 i=0; LCDD_CONFIG_T lcddReadConfig=LCDD_READ_CONFIG; lcdd_SetBrightness(7); #ifdef USE_SPI_LCD hal_GoudaSerialOpen(LCDD_SPI_LINE_TYPE, LCDD_SPI_FREQ, &lcddReadConfig.config, 0); #else hal_GoudaOpen(&lcddReadConfig.config, lcddReadConfig.timings, 0); #endif sxr_Sleep(20 MS_WAITING); lcdd_Init(); g_lcddInSleep = FALSE; return LCDD_ERR_NO; }
// ============================================================================ // lcddp_WakeUp // ---------------------------------------------------------------------------- /// Wake the main LCD screen out of sleep mode /// @return #LCDD_ERR_NO, #LCDD_ERR_NOT_OPENED // ============================================================================ PRIVATE LCDD_ERR_T lcddp_WakeUp(VOID) { if (0 == lcdd_MutexGet()) { sxr_Sleep(LCDD_TIME_MUTEX_RETRY); LCDD_TRACE(TSTDOUT, 0, "LCDD: Wakeup while another LCD operation in progress. Sleep %d ticks", LCDD_TIME_MUTEX_RETRY); } if (!g_lcddInSleep) { lcdd_MutexFree(); return LCDD_ERR_NO; } LCDD_TRACE(TSTDOUT, 0, "lcddp_WakeUp: calling hal_GoudaOpen"); hal_GoudaOpen(&g_tgtLcddCfg.config, g_tgtLcddCfg.timings, 0); #if 0 LCM_WR_REG(0x18,0x44); LCM_WR_REG(0x21,0x01); LCM_WR_REG(0x01,0x00); LCM_WR_REG(0x1c,0x03); LCM_WR_REG(0x19,0x06); sxr_Sleep(5 MS_WAITING); LCM_WR_REG(0x26,0x84); sxr_Sleep(40 MS_WAITING); LCM_WR_REG(0x26,0xb8); sxr_Sleep(40 MS_WAITING); LCM_WR_REG(0x26,0xbc); #else lcddp_Init(); #endif g_lcddInSleep = FALSE; lcdd_MutexFree(); // Set a comfortable background color to avoid screen flash LCDD_FBW_T frameBufferWin; frameBufferWin.fb.buffer = NULL; frameBufferWin.fb.colorFormat = LCDD_COLOR_FORMAT_RGB_565; frameBufferWin.roi.x=0; frameBufferWin.roi.y=0; if (g_lcddRotate) { frameBufferWin.roi.width = LCDD_DISP_Y; frameBufferWin.roi.height = LCDD_DISP_X; frameBufferWin.fb.width = LCDD_DISP_Y; frameBufferWin.fb.height = LCDD_DISP_X; } else { frameBufferWin.roi.width = LCDD_DISP_X; frameBufferWin.roi.height = LCDD_DISP_Y; frameBufferWin.fb.width = LCDD_DISP_X; frameBufferWin.fb.height = LCDD_DISP_Y; } lcddp_Blit16(&frameBufferWin,frameBufferWin.roi.x,frameBufferWin.roi.y); return LCDD_ERR_NO; }