PRIVATE LCDD_ERR_T lcddp_Sleep(VOID) { while (0 == lcdd_MutexGet()) { sxr_Sleep(LCDD_TIME_MUTEX_RETRY); LCDD_TRACE(TSTDOUT, 0, "LCDD: Sleep while another LCD operation in progress. Sleep %d ticks", LCDD_TIME_MUTEX_RETRY); } if (g_lcddInSleep) { lcdd_MutexFree(); return LCDD_ERR_NO; } LCM_WR_REG(0x0007, 0x1016); // Set GON=1, D1=1, D0=0 sxr_Sleep(50 MS_WAITING); LCM_WR_REG(0x0007, 0x1014); // Set GON=1, D1=0, D0=0 sxr_Sleep(20 MS_WAITING); LCM_WR_REG(0x0010, 0x0801); // Enter Standby mode LCDD_TRACE(TSTDOUT, 0, "lcddp_Sleep: calling hal_GoudaClose"); hal_GoudaClose(); g_lcddInSleep = TRUE; lcdd_MutexFree(); 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); // 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; }
// ============================================================================= // lcddp_Init // ----------------------------------------------------------------------------- /// This function initializes LCD registers after powering on or waking up. // ============================================================================= PRIVATE VOID lcddp_Init(VOID) { //************* Start Initial Sequence **********// LCM_WR_REG(0x0001, 0x021c); // set SS and NL bit 0x001c LCM_WR_REG(0x0002, 0x0100); // set 1 line inversion if (g_lcddRotate) { LCM_WR_REG(0x0003, 0x1018); // } else { LCM_WR_REG(0x0003, 0x1000); // } LCM_WR_REG(0x0008, 0x0808); // set BP and FP LCM_WR_REG(0x000B, 0x1100); LCM_WR_REG(0x000C, 0x0000); // RGB interface setting R0Ch=0x0110 for RGB 18Bit and R0Ch=0111for RGB16Bit LCM_WR_REG(0x000F, 0x0e01); // Set frame rate //0a01 //*************Power On sequence ****************// sxr_Sleep(50 MS_WAITING); // Delay 50ms LCM_WR_REG(0x0010, 0x0800); // Set SAP,DSTB,STB LCM_WR_REG(0x0011, 0x1038); // Set APON,PON,AON,VCI1EN,VC sxr_Sleep(50 MS_WAITING); // Delay 50ms LCM_WR_REG(0x0012, 0x1000); // Internal reference voltage= Vci; LCM_WR_REG(0x0013, 0x0068); // Set GVDD LCM_WR_REG(0x0014, 0x4360); // Set VCOMH/VCOML voltage LCM_WR_REG(0x0015, 0x0020); //------------- Set GRAM area ------------------// LCM_WR_REG(0x0030, 0x0000); LCM_WR_REG(0x0031, 0x00DB); LCM_WR_REG(0x0032, 0x0000); LCM_WR_REG(0x0033, 0x0000); LCM_WR_REG(0x0034, 0x00DB); LCM_WR_REG(0x0035, 0x0000); LCM_WR_REG(0x0036, 0x00AF); LCM_WR_REG(0x0037, 0x0000); LCM_WR_REG(0x0038, 0x00DB); LCM_WR_REG(0x0039, 0x0000); LCM_WR_REG(0x0050, 0x0101); LCM_WR_REG(0x0051, 0x0b04); LCM_WR_REG(0x0052, 0x0006); LCM_WR_REG(0x0053, 0x0600); LCM_WR_REG(0x0054, 0x040b); LCM_WR_REG(0x0055, 0x0101); LCM_WR_REG(0x0056, 0x0503); LCM_WR_REG(0x0057, 0x0305); LCM_WR_REG(0x0058, 0x0106); LCM_WR_REG(0x0059, 0x0104); sxr_Sleep(50 MS_WAITING); // Delay 50ms LCM_WR_REG(0x0007, 0x1017); LCM_WR_CMD(0x0022); }
PRIVATE LCDD_ERR_T lcddp_Sleep(VOID) { while (0 == lcdd_MutexGet()) { sxr_Sleep(LCDD_TIME_MUTEX_RETRY); LCDD_TRACE(TSTDOUT, 0, "LCDD: Sleep while another LCD operation in progress. Sleep %d ticks", LCDD_TIME_MUTEX_RETRY); } if (g_lcddInSleep) { lcdd_MutexFree(); return LCDD_ERR_NO; } LCM_WR_CMD_8(0x10); hal_TimDelay(120 MS_WAITING); LCDD_TRACE(TSTDOUT, 0, "lcddp_Sleep: calling hal_GoudaClose"); hal_GoudaClose(); g_lcddInSleep = TRUE; lcdd_MutexFree(); 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_SetDirDefault // ---------------------------------------------------------------------------- /// // ============================================================================ PRIVATE BOOL lcddp_SetDirDefault(VOID) { while (0 == lcdd_MutexGet()) { sxr_Sleep(LCDD_TIME_MUTEX_RETRY); } g_lcddRotate = FALSE; if (g_lcddInSleep) { lcdd_MutexFree(); return TRUE; } main_Write_COM(0x36); //Set Scanning Direction main_Write_DATA(0xA8); //0xc0 //LCM_WR_REG(0x36,0xC8); // LCM_WR_CMD_8(0x36); //Set Scanning Direction // LCM_WR_DATA_8(0xC0); hal_TimDelay(1 MS_WAITING); lcdd_MutexFree(); return TRUE; }
PRIVATE LCDD_ERR_T lcddp_Sleep(VOID) { while (0 == lcdd_MutexGet()) { sxr_Sleep(LCDD_TIME_MUTEX_RETRY); LCDD_TRACE(TSTDOUT, 0, "LCDD: Sleep while another LCD operation in progress. Sleep %d ticks", LCDD_TIME_MUTEX_RETRY); } if (g_lcddInSleep) { lcdd_MutexFree(); return LCDD_ERR_NO; } LCM_WR_REG(0x0010, 0x0003); // Power Control 1 // Enter Standby mode LCDD_TRACE(TSTDOUT, 0, "lcddp_Sleep: calling hal_GoudaClose"); hal_GoudaClose(); g_lcddInSleep = TRUE; lcdd_MutexFree(); return LCDD_ERR_NO; }
// ============================================================================ // lcddp_SetDirRotation // ---------------------------------------------------------------------------- /// // ============================================================================ PRIVATE BOOL lcddp_SetDirRotation(VOID) { while (0 == lcdd_MutexGet()) { sxr_Sleep(LCDD_TIME_MUTEX_RETRY); } g_lcddRotate = TRUE; if (g_lcddInSleep) { lcdd_MutexFree(); return TRUE; } LCM_WR_CMD_8(0x36); //Set Scanning Direction LCM_WR_DATA_8(0xA8); hal_TimDelay(1 MS_WAITING); lcdd_MutexFree(); return TRUE; }
// ============================================================================ // 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; }
uint32 ScsiUnitAttention(PSCSI_DEVICE pDevice, uint8 Lun) { uint32 dwRepeat, dwErr, dwStartErr, dwSenseErr; dwRepeat = pDevice->Timeouts.UnitAttnRepeat; do { dwErr = ScsiTestUnitReady(pDevice, Lun); if (dwErr == ERROR_GEN_FAILURE) { // break; ; } if (ERROR_ACCESS_DENIED == dwErr || ERROR_INVALID_HANDLE == dwErr) { // break; ; } else if (ERROR_SUCCESS != dwErr) { // some devices require a (re)start dwStartErr = ScsiStartStopUnit(pDevice, TRUE, FALSE, Lun); if (ERROR_ACCESS_DENIED == dwStartErr || ERROR_INVALID_HANDLE == dwStartErr) { dwErr = dwStartErr; // break; ; } else if (ERROR_SUCCESS != dwStartErr) { // clear error dwSenseErr = ScsiGetSenseData(pDevice, Lun); if (ERROR_ACCESS_DENIED == dwSenseErr || ERROR_INVALID_HANDLE == dwSenseErr) { dwErr = dwSenseErr; // break; ; } } sxr_Sleep(10); } }while (ERROR_SUCCESS != dwErr && --dwRepeat != 0); return dwErr; }
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; }
// ============================================================================ // lcddp_SetDirRotation // ---------------------------------------------------------------------------- /// // ============================================================================ PRIVATE BOOL lcddp_SetDirRotation(VOID) { while (0 == lcdd_MutexGet()) { sxr_Sleep(LCDD_TIME_MUTEX_RETRY); } g_lcddRotate = TRUE; if (g_lcddInSleep) { lcdd_MutexFree(); return TRUE; } LCM_WR_REG(0x03, 0x1018); // lcdd_MutexFree(); return TRUE; }
kal_uint8 rdabt_get_lmpversion(void) { kal_uint16 rx_length=0; kal_uint8 rx_buff[128]; kal_uint8 status; kal_uint16 num_send; kal_uint8 i; mmi_trace(1,"rdabt_get_lmpversion is called!"); mmi_trace(1,"rdabt_get_lmpversion is called!"); //UART_ClrRxBuffer(BT_UART_PORT,MOD_MMI); i= rdabt_uart_tx((kal_uint8 *)rda5868_read_lmpversion,sizeof(rda5868_read_lmpversion),&num_send); mmi_trace(1,"rda5868_uart_tx i=%d",i); sxr_Sleep(156*5);//90ms rx_length = UART_GetBytes(BT_UART_PORT, rx_buff, 128, &status, MOD_MMI); //kal_prompt_trace(0,"rda5868_chipid = %x",rda5868_chipid); mmi_trace(1,"rdabt_get_lmpversion rx_length=%x",rx_length); for(i=0; i<rx_length; i++) mmi_trace(1,"rx_buff[%d]=0x%x",i,rx_buff[i]); return rx_buff[66]; }
// ============================================================================ // lcddp_SetDirDefault // ---------------------------------------------------------------------------- /// // ============================================================================ PRIVATE BOOL lcddp_SetDirDefault(VOID) { while (0 == lcdd_MutexGet()) { sxr_Sleep(LCDD_TIME_MUTEX_RETRY); } g_lcddRotate = FALSE; if (g_lcddInSleep) { lcdd_MutexFree(); return TRUE; } LCM_WR_REG(0x0016, 0x08); // lcdd_MutexFree(); return TRUE; }
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; }
// ============================================================================= // fmd_SetVolume // ----------------------------------------------------------------------------- /// This function sets the volume and other audio related paramters. /// @param volume analog volume /// @param bassBoost enable/disable bass boost /// @param forceMono enable/disable mono output of stereo radios /// @return \c FMD_ERR_NO or \c FMD_ERR_RESOURCE_BUSY // ============================================================================= PUBLIC FMD_ERR_T fmd_SetVolume(FMD_ANA_LEVEL_T volume, BOOL bassBoost, BOOL forceMono) { FMD_ERR_T errStatus=0; UINT8 dacVol; FMD_ASSERT(volume < FMD_ANA_VOL_QTY, "FMD volume out of range (%d)", volume); // compute the mute bit if (volume == FMD_ANA_MUTE) { // fmd_Write(0x10,0xc500); // close adac } else { //fmd_Write(0x10,0x8500); // open adac } sxr_Sleep(50 MILLI_SECONDS); //not use bassBoost //not use forceMono // get volume value from config dacVol = g_fmdConfig->volumeVal[6]; #if ((RDA5888_CHIP_VER == 6) || (RDA5888_CHIP_VER == 7)) atvd_SetVolume(30); //RDA5888_WriteReg(0x12f, 0x0076); //0x0075 #else fmd_FieldWrite(0x125, 0xff80, dacVol); #endif return errStatus; }
// ============================================================================= // lcddp_Init // ----------------------------------------------------------------------------- /// This function initializes LCD registers after powering on or waking up. // ============================================================================= PRIVATE VOID lcddp_Init(VOID) { hal_HstSendEvent(0x88855504); UINT32 i = 0; lcddp_SpiActivateCs(); WriteCommand_Addr(0x11); // SLPOUT //DelayX1ms(150); sxr_Sleep(150 MS_WAITING); WriteCommand_Addr(0xB9); //SETEXTC WriteCommand_Data(0xFF); WriteCommand_Data(0x83); WriteCommand_Data(0x53); WriteCommand_Addr(0xC6); //UADJ Frame Rate=60Hz WriteCommand_Data(0x31); WriteCommand_Addr(0xB2); //SET DISPLAY WriteCommand_Data(0x00); WriteCommand_Addr(0xB1); //SETPWCTR WriteCommand_Data(0x00); //DP_STB WriteCommand_Data(0x00); //Set BT_VGH WriteCommand_Data(0x0A); WriteCommand_Addr(0xBF); //SETPTBA WriteCommand_Data(0x04); //PTBA[15:8] // Power driving setting WriteCommand_Data(0x38); //PTBA[7:0] // Power driving setting WriteCommand_Addr(0xC0); //SETSTBA WriteCommand_Data(0x18); //N_OPON // OP driving--18 WriteCommand_Data(0x08); //I_OPON // Idle for OP driving WriteCommand_Data(0x0C); //STBA[15:8] // Source Driving setting WriteCommand_Data(0xCA); //STBA[7:0] // Source Driving setting WriteCommand_Addr(0xE3); //EQ WriteCommand_Data(0x28); //VCI_M1 WriteCommand_Data(0x08); //GND_M1 WriteCommand_Data(0x08); //VCI_M0 WriteCommand_Data(0x18); //GND_M0 WriteCommand_Addr(0xB6); //VCOM WriteCommand_Data(0x93); //VMF WriteCommand_Data(0x42); //VMH WriteCommand_Data(0x62); //VML WriteCommand_Addr(0xE0); //Gamma setting for Panel WriteCommand_Data(0x00); //1 WriteCommand_Data(0x77); //2 WriteCommand_Data(0x21); //3 WriteCommand_Data(0x08); //4 WriteCommand_Data(0xDF); //5 WriteCommand_Data(0x08); //6 WriteCommand_Data(0x07); //7 WriteCommand_Data(0x08); //8 WriteCommand_Data(0x05); //9 WriteCommand_Data(0x07); //10 WriteCommand_Data(0x65); //11 WriteCommand_Data(0x00); //12 WriteCommand_Data(0x77); //13 WriteCommand_Data(0x07); //14 WriteCommand_Data(0xC0); //15 WriteCommand_Data(0x07); //16 WriteCommand_Data(0x08); //17 WriteCommand_Data(0x07); //18 WriteCommand_Data(0x0A); //19 WriteCommand_Addr(0x2A); WriteCommand_Data(0x00); WriteCommand_Data(0x00); WriteCommand_Data(0x00); WriteCommand_Data(0x7f); WriteCommand_Addr(0x2B); WriteCommand_Data(0x00); WriteCommand_Data(0x01); WriteCommand_Data(0x00); WriteCommand_Data(0x9f); WriteCommand_Addr(0x36); WriteCommand_Data(0xc0); WriteCommand_Addr(0x3A); WriteCommand_Data(0x05); WriteCommand_Addr(0x2D); for(i=0 ; i<32; i++) WriteCommand_Data(i*2); for(i=0 ; i<64 ; i++) WriteCommand_Data(i); for(i=0 ; i<32 ; i++) WriteCommand_Data(i*2); WriteCommand_Addr(0xB0); //RADJ WriteCommand_Data(0xC0); WriteCommand_Addr(0xCB); //CADJ WriteCommand_Data(0x00); WriteCommand_Addr(0x2C); //DelayX1ms(150); sxr_Sleep(150 MS_WAITING); WriteCommand_Addr(0x29); // display on // DelayX1ms(150);} sxr_Sleep(150 MS_WAITING); }
// ============================================================================= // calib_StubTaskInit // ----------------------------------------------------------------------------- /// Calib Stub OS task. // ============================================================================= PROTECTED VOID calib_StubTaskInit(VOID) { UINT32 evt[4]; Msg_t *msg; #ifdef CES_DISPLAY LCDD_SCREEN_INFO_T screenInfo; GFX_ROI_T fullScreenRoi; #endif CALIB_PROFILE_FUNCTION_ENTER(calib_StubTestTaskInit); /// Some initialization. /// Enable full-speed access to flash and ram. memd_FlashOpen(tgt_GetMemdFlashConfig()); memd_RamOpen(tgt_GetMemdRamConfig()); #if (CHIP_HAS_USB == 1) && (CALIB_WITHOUT_USB != 1) uctls_Open(g_calibStubMbx, 0, 0, 0, "USB Calib"); uctls_SetMode(UCTLS_ID_TRACE); // Force usb power cycle uctls_ChargerStatus(UCTLS_CHARGER_STATUS_DISCONNECTED); sxr_Sleep(8000); // Initiate charger status calib_ChargerHandler(pmd_GetChargerStatus()); // Configure PMD to warn the calib when a charger is plugged. pmd_SetChargerStatusHandler(calib_ChargerHandler); #endif // CHIP_HAS_USB && (CALIB_WITHOUT_USB != 1) #ifdef CES_DISPLAY /// Setup the display. lcdd_Open(); lcdd_SetStandbyMode(FALSE); lcdd_GetScreenInfo(&screenInfo); // Fill the whole screen with white. fullScreenRoi.start.x = 0; fullScreenRoi.start.y = 0; fullScreenRoi.width = screenInfo.width; fullScreenRoi.height = screenInfo.height; while (LCDD_ERR_NO != lcdd_FillRect16(&fullScreenRoi, 0xffff)); /// Draw a cool logo. while (lcdd_Blit16(&g_calibLogoFbw, 0, 0) != LCDD_ERR_NO); lcdd_SetBrightness(6); fmg_PrintfInit(0, 8, screenInfo.width, screenInfo.height); SXS_TRACE(TSTDOUT, "Running code: Calib Embedded Stub"); /// Switch ON/OFF PAL traces. sxs_SetTraceLevel(_PAL, 0x1); #endif // Start the calibration stub calib_StubOpen(); /// Update the display. calib_DispState(TRUE); /// Start the display refresh and battery monitoring timers. sxs_StartTimer(DISP_TIME, DISP_TIMER, NULL, FALSE, g_calibStubMbx); /// Main loop. while (1) { /// Wait for a timer event or a key message. msg = sxr_Wait(evt, g_calibStubMbx); if (msg == 0) { /// Refresh screen. if (evt[0] == DISP_TIMER) { CALIB_PROFILE_PULSE(calib_StubTimDisp); /// Update the display. calib_DispState(FALSE); /// Wakeup the task to update the display. sxs_StartTimer(DISP_TIME, DISP_TIMER, NULL, FALSE, g_calibStubMbx); } /// Skip the message handling. continue; } else { /// Free the message. sxr_Free(msg); /// Don't handle the key pressing. } } }
// ============================================================================= // lcddp_Init // ----------------------------------------------------------------------------- /// This function initializes LCD registers after powering on or waking up. // ============================================================================= PRIVATE VOID lcddp_Init(VOID) { //************* Start Initial Sequence **********// LCM_WR_REG(0x0001, 0x021c); // set SS and NL bit 0x001c LCM_WR_REG(0x0002, 0x0100); // set 1 line inversion if (g_lcddRotate) { LCM_WR_REG(0x0003, 0x1018); // 0x1030 ? } else { LCM_WR_REG(0x0003, 0x1000); // set GRAM write direction and BGR=1 } LCM_WR_REG(0x0008, 0x0808); // set BP and FP LCM_WR_REG(0x000C, 0x0003); // RGB interface setting R0Ch=0x0110 for RGB 18Bit and R0Ch=0111for RGB16Bit LCM_WR_REG(0x000F, 0x0a01); // Set frame rate //0a01 LCM_WR_REG(0x0020, 0x00AF); // Set GRAM Address LCM_WR_REG(0x0021, 0x00DB); // Set GRAM Address //*************Power On sequence ****************// sxr_Sleep(50 MS_WAITING); // Delay 50ms LCM_WR_REG(0x0010, 0x0800); // Set SAP,DSTB,STB LCM_WR_REG(0x0011, 0x1038); // Set APON,PON,AON,VCI1EN,VC sxr_Sleep(50 MS_WAITING); // Delay 50ms LCM_WR_REG(0x0012, 0x1121); // Internal reference voltage= Vci; LCM_WR_REG(0x0013, 0x0063); // Set GVDD LCM_WR_REG(0x0014, 0x4444); // Set VCOMH/VCOML voltage //------------- Set GRAM area ------------------// LCM_WR_REG(0x0030, 0x0000); LCM_WR_REG(0x0031, 0x00DB); LCM_WR_REG(0x0032, 0x0000); LCM_WR_REG(0x0033, 0x0000); LCM_WR_REG(0x0034, 0x00DB); LCM_WR_REG(0x0035, 0x0000); LCM_WR_REG(0x0036, 0x00AF); LCM_WR_REG(0x0037, 0x0000); LCM_WR_REG(0x0038, 0x00DB); LCM_WR_REG(0x0039, 0x0000); // ----------- Adjust the Gamma Curve ----------// LCM_WR_REG(0x0001, 0x021c); // set SS and NL bit 0x001c LCM_WR_REG(0x0002, 0x0100); // set 1 line inversion LCM_WR_REG(0x0003, 0x1000); // set GRAM write direction and BGR=1. //0x1010 LCM_WR_REG(0x0008, 0x0808); // set BP and FP LCM_WR_REG(0x000C, 0x0003); // RGB interface setting R0Ch=0x0110 for RGB 18Bit and R0Ch=0111for RGB16Bit LCM_WR_REG(0x000F, 0x0a01); // Set frame rate //0a01 LCM_WR_REG(0x0020, 0x00AF); // Set GRAM Address LCM_WR_REG(0x0021, 0x00DB); // Set GRAM Address //*************Power On sequence ****************// sxr_Sleep(50 MS_WAITING); // Delay 50ms LCM_WR_REG(0x0010, 0x0800); // Set SAP,DSTB,STB LCM_WR_REG(0x0011, 0x1038); // Set APON,PON,AON,VCI1EN,VC sxr_Sleep(50 MS_WAITING); // Delay 50ms LCM_WR_REG(0x0012, 0x1121); // Internal reference voltage= Vci; LCM_WR_REG(0x0013, 0x0063); // Set GVDD LCM_WR_REG(0x0014, 0x4444); // Set VCOMH/VCOML voltage LCM_WR_REG(0x0050, 0x0400); LCM_WR_REG(0x0051, 0x080B); LCM_WR_REG(0x0052, 0x0E0C); LCM_WR_REG(0x0053, 0x0103); LCM_WR_REG(0x0054, 0x0C0E); LCM_WR_REG(0x0055, 0x0B08); LCM_WR_REG(0x0056, 0x0004); LCM_WR_REG(0x0057, 0x0301); LCM_WR_REG(0x0058, 0x0E00); LCM_WR_REG(0x0059, 0x000E); sxr_Sleep(50 MS_WAITING); // Delay 50ms LCM_WR_REG(0x0007, 0x1017); LCM_WR_CMD(0x0022); }
// ============================================================================= // lcddp_Init // ----------------------------------------------------------------------------- /// This function initializes LCD registers after powering on or waking up. // ============================================================================= PRIVATE VOID lcddp_Init(VOID) { LCM_WR_CMD(0x11); //exiting from deep standby mode sxr_Sleep(120 MS_WAITING); //Delay 120ms LCM_WR_CMD(0x2A); LCM_WR_DAT(0x00); LCM_WR_DAT(0x00); LCM_WR_DAT(0x00); LCM_WR_DAT(0x7F); LCM_WR_CMD(0x2B); LCM_WR_DAT(0x00); LCM_WR_DAT(0x00); LCM_WR_DAT(0x00); LCM_WR_DAT(0x9F); LCM_WR_CMD(0x3a); // 16-bit color format LCM_WR_DAT(0x05); LCM_WR_CMD(0xB1); LCM_WR_DAT(0x01); //0x05 LCM_WR_DAT(0x2C); //0x3c LCM_WR_DAT(0x2D); //0x3c LCM_WR_CMD(0xB2); LCM_WR_DAT(0x01); LCM_WR_DAT(0x2C); LCM_WR_DAT(0x2D); LCM_WR_CMD(0xB3); LCM_WR_DAT(0x01); LCM_WR_DAT(0x2C); LCM_WR_DAT(0x2D); LCM_WR_DAT(0x01); LCM_WR_DAT(0x2C); LCM_WR_DAT(0x2D); //--------End frame Rate--------// LCM_WR_CMD(0xB4); //column inversion LCM_WR_DAT(0x03); //0x07 LCM_WR_CMD(0xB6); //column inversion LCM_WR_DAT(0xB4); LCM_WR_DAT(0xF0); LCM_WR_CMD(0xC0); LCM_WR_DAT(0xA2); LCM_WR_DAT(0x02); LCM_WR_DAT(0x84); LCM_WR_CMD(0xC1); LCM_WR_DAT(0xC5); LCM_WR_CMD(0xC2); LCM_WR_DAT(0x0A); LCM_WR_DAT(0x00); LCM_WR_CMD(0xC3); LCM_WR_DAT(0x8A); LCM_WR_DAT(0x2A); LCM_WR_CMD(0xC4); LCM_WR_DAT(0x8A); LCM_WR_DAT(0xEE); LCM_WR_CMD(0xC5); //VCOM,ˮ,ʵֵ LCM_WR_DAT(0x18); //0x14//0x18//0x0a LCM_WR_CMD(0x36); //MX,MY,RGB mode LCM_WR_DAT(0xC8); //MV=MH=MX=MY=ML=0 and RGB filter panel //---------gamma--------------// LCM_WR_CMD(0xE0); //Enable Gamma bit LCM_WR_DAT(0x02); LCM_WR_DAT(0x06);//0x1A 0x1c LCM_WR_DAT(0x07);//p1 LCM_WR_DAT(0x12);//p2 LCM_WR_DAT(0x37);//p3 LCM_WR_DAT(0x32);//p4 LCM_WR_DAT(0x29);//p5 LCM_WR_DAT(0x2D);//p6 LCM_WR_DAT(0x29);//p7 LCM_WR_DAT(0x25);//p8 LCM_WR_DAT(0x2B);//p9 LCM_WR_DAT(0x39);//p10 LCM_WR_DAT(0x00);//p11 LCM_WR_DAT(0x01);//p12 LCM_WR_DAT(0x03);//p13 LCM_WR_DAT(0x10);//p14 LCM_WR_CMD(0xE1); LCM_WR_DAT(0x03);//p1 LCM_WR_DAT(0x1D);//p2 LCM_WR_DAT(0x07);//p3 LCM_WR_DAT(0x06);//p4 LCM_WR_DAT(0x2E);//p5 LCM_WR_DAT(0x2C);//p6 LCM_WR_DAT(0x29);//p7 LCM_WR_DAT(0x2D);//p8 LCM_WR_DAT(0x2E);//p9 LCM_WR_DAT(0x2E);//p10 LCM_WR_DAT(0x37);//p11 LCM_WR_DAT(0x3F);//p12 LCM_WR_DAT(0x00);//p13 LCM_WR_DAT(0x00);//p14 LCM_WR_DAT(0x02);//p15 LCM_WR_DAT(0x10);//p15 LCM_WR_CMD(0xF0); //enable test command LCM_WR_DAT(0x01); LCM_WR_CMD(0xF6); //disable ram power save mode LCM_WR_DAT(0x00); sxr_Sleep(120 MS_WAITING); //DISPLAY ON LCM_WR_CMD(0x29); sxr_Sleep(120 MS_WAITING); //ȡ 09h õֿϢ //ST7735R_GetStatus(); LCM_WR_CMD(0x2c); #if 0 LCM_WR_CMD(0x11); //Sleep out sxr_Sleep(120 MS_WAITING);; //Delay 120ms //------------------------------------ST7735R Frame Rate-----------------------------------------// LCM_WR_CMD(0xB1); LCM_WR_DAT(0x01); LCM_WR_DAT(0x2C); LCM_WR_DAT(0x2D); LCM_WR_CMD(0xB2); LCM_WR_DAT(0x01); LCM_WR_DAT(0x2C); LCM_WR_DAT(0x2D); LCM_WR_CMD(0xB3); LCM_WR_DAT(0x01); LCM_WR_DAT(0x2C); LCM_WR_DAT(0x2D); LCM_WR_DAT(0x01); LCM_WR_DAT(0x2C); LCM_WR_DAT(0x2D); //------------------------------------End ST7735R Frame Rate-----------------------------------------// LCM_WR_CMD(0xB4); //Column inversion LCM_WR_DAT(0x07); //------------------------------------ST7735R Power Sequence-----------------------------------------// LCM_WR_CMD(0xC0); LCM_WR_DAT(0xA2); LCM_WR_DAT(0x02); LCM_WR_DAT(0x84); LCM_WR_CMD(0xC1); LCM_WR_DAT(0xC5); LCM_WR_CMD(0xC2); LCM_WR_DAT(0x0A); LCM_WR_DAT(0x00); LCM_WR_CMD(0xC3); LCM_WR_DAT(0x8A); LCM_WR_DAT(0x2A); LCM_WR_CMD(0xC4); LCM_WR_DAT(0x8A); LCM_WR_DAT(0xEE); //---------------------------------End ST7735R Power Sequence-------------------------------------// LCM_WR_CMD(0xC5); //VCOM LCM_WR_DAT(0x0E); LCM_WR_CMD(0x36); //MX, MY, RGB mode LCM_WR_DAT(0xC8); //LCM_WR_CMD(0x20); //rev off LCM_WR_CMD(0x21); //rev on //------------------------------------ST7735R Gamma Sequence-----------------------------------------// LCM_WR_CMD(0xe0); LCM_WR_DAT(0x02); LCM_WR_DAT(0x1c); LCM_WR_DAT(0x07); LCM_WR_DAT(0x12); LCM_WR_DAT(0x37); LCM_WR_DAT(0x32); LCM_WR_DAT(0x29); LCM_WR_DAT(0x2d); LCM_WR_DAT(0x29); LCM_WR_DAT(0x25); LCM_WR_DAT(0x2b); LCM_WR_DAT(0x39); LCM_WR_DAT(0x00); LCM_WR_DAT(0x01); LCM_WR_DAT(0x03); LCM_WR_DAT(0x10); LCM_WR_CMD(0xe1); LCM_WR_DAT(0x03); LCM_WR_DAT(0x1d); LCM_WR_DAT(0x07); LCM_WR_DAT(0x06); LCM_WR_DAT(0x2e); LCM_WR_DAT(0x2c); LCM_WR_DAT(0x29); LCM_WR_DAT(0x2d); LCM_WR_DAT(0x2e); LCM_WR_DAT(0x2e); LCM_WR_DAT(0x37); LCM_WR_DAT(0x3f); LCM_WR_DAT(0x00); LCM_WR_DAT(0x00); LCM_WR_DAT(0x02); LCM_WR_DAT(0x10); //------------------------------------End ST7735R Gamma Sequence-----------------------------------------// LCM_WR_CMD(0x3A); //65k mode LCM_WR_DAT(0x05); LCM_WR_CMD(0x29); //Display on #endif }
// ============================================================================ // 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; }
PRIVATE UINT16 lcddp_Open_Read_LcdId(VOID) { // return 1; UINT32 count; // UINT8 data[6] = {0x0,0x0,0x0,0x0,0x0,0x0}; // UINT8 iTempData[6] = {0x9, 0xff,0xff,0xff,0xff,0xff}; UINT8 data[3] = {0x0,0x0,0x0}; UINT8 iTempData[3] = {0xdb,0xff, 0xff}; // UINT8 dummy = 0; HAL_SPI_CFG_T slcd_spiCfg = { .enabledCS = HAL_SPI_CS0, .csActiveLow = TRUE, .inputEn = TRUE, .clkFallEdge = TRUE, .clkDelay = HAL_SPI_HALF_CLK_PERIOD_0, .doDelay = HAL_SPI_HALF_CLK_PERIOD_0, .diDelay = HAL_SPI_HALF_CLK_PERIOD_1, .csDelay = HAL_SPI_HALF_CLK_PERIOD_1, .csPulse = HAL_SPI_HALF_CLK_PERIOD_0,//HAL_SPI_HALF_CLK_PERIOD_1 .frameSize = 8, .oeRatio = 8, .spiFreq = 1000000,//5M 5000000 .rxTrigger = HAL_SPI_RX_TRIGGER_4_BYTE, .txTrigger = HAL_SPI_TX_TRIGGER_1_EMPTY, .rxMode = HAL_SPI_DIRECT_POLLING, .txMode = HAL_SPI_DIRECT_POLLING, .mask = {0,0,0,0,0}, .handler = NULL }; hal_SpiOpen(HAL_SPI,HAL_SPI_CS0, &slcd_spiCfg); hal_SpiActivateCs(HAL_SPI,HAL_SPI_CS0); hal_GpioClr(g_slcd_a0); // hal_SpiSendData(HAL_SPI,HAL_SPI_CS0,&dummy,1); //wait until any previous transfers have ended // while(!hal_SpiTxFinished(HAL_SPI,HAL_SPI_CS0));hal_GpioSet(g_slcd_a0); hal_SpiSendData(HAL_SPI,HAL_SPI_CS0,iTempData,3); //wait until any previous transfers have ended while(!hal_SpiTxFinished(HAL_SPI,HAL_SPI_CS0));//hal_GpioSet(g_slcd_a0); count = hal_SpiGetData(HAL_SPI,HAL_SPI_CS0,data, 3); hal_SpiDeActivateCs(HAL_SPI,HAL_SPI_CS0); hal_SpiClose(HAL_SPI,HAL_SPI_CS0); SXS_TRACE(TSTDOUT, "hx8535d: lcd read id is 0x%x 0x%x 0x%x ,count=%d",data[0],data[1],data[2],count); return (UINT16)data[1]; } PRIVATE VOID lcddp_Open_Spi(VOID) { HAL_SPI_CFG_T slcd_spiCfg = { .enabledCS = HAL_SPI_CS0, .csActiveLow = TRUE, .inputEn = TRUE, .clkFallEdge = TRUE, .clkDelay = HAL_SPI_HALF_CLK_PERIOD_0, .doDelay = HAL_SPI_HALF_CLK_PERIOD_0, .diDelay = HAL_SPI_HALF_CLK_PERIOD_1, .csDelay = HAL_SPI_HALF_CLK_PERIOD_1, .csPulse = HAL_SPI_HALF_CLK_PERIOD_0,//HAL_SPI_HALF_CLK_PERIOD_1 .frameSize = 8, .oeRatio = 0, .spiFreq = 20000000,//5M 5000000 15M 20M(33ms-per-frame) 39M(13ms-per-frame) .rxTrigger = HAL_SPI_RX_TRIGGER_4_BYTE, .txTrigger = HAL_SPI_TX_TRIGGER_1_EMPTY, .rxMode = HAL_SPI_DIRECT_POLLING, .txMode = HAL_SPI_DMA_POLLING, .mask = {0,0,0,0,0}, .handler = NULL }; hal_SpiOpen(HAL_SPI,HAL_SPI_CS0, &slcd_spiCfg); } // ============================================================================ // 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_HstSendEvent(0x88855503); //hal_GoudaOpen(&g_tgtLcddCfg.config, g_tgtLcddCfg.timings, 0); hal_GpioSetOut(g_slcd_a0.gpioId); lcddp_Open_Spi(); lcddp_Init(); hal_TimDelay(1 MS_WAITING); g_lcddInSleep = FALSE; return LCDD_ERR_NO; } // ============================================================================ // lcddp_Close // ---------------------------------------------------------------------------- /// Close the LCDD driver /// No other functions of this driver should be called after a call to /// #lcddp_Close. /// @return #LCDD_ERR_NO or #LCDD_ERR_DEVICE_NOT_FOUND. // ============================================================================ PRIVATE LCDD_ERR_T lcddp_Close(VOID) { // hal_GoudaClose(); lcddp_SpiDeActivateCs(); return LCDD_ERR_NO; } // ============================================================================ // lcddp_SetContrast // ---------------------------------------------------------------------------- /// Set the contrast of the 'main'LCD screen. /// @param contrast Value to set the contrast to. /// @return #LCDD_ERR_NO, #LCDD_ERR_NOT_OPENED or /// #LCDD_ERR_INVALID_PARAMETER. // ============================================================================ PRIVATE LCDD_ERR_T lcddp_SetContrast(UINT32 contrast) { //#warning This function is not implemented yet return LCDD_ERR_NO; } // ============================================================================ // lcddp_SetStandbyMode // ---------------------------------------------------------------------------- /// Set the main LCD in standby mode or exit from it /// @param standbyMode If \c TRUE, go in standby mode. /// If \c FALSE, cancel standby mode. /// @return #LCDD_ERR_NO, #LCDD_ERR_NOT_OPENED or /// #LCDD_ERR_INVALID_PARAMETER. // ============================================================================ PRIVATE LCDD_ERR_T lcddp_SetStandbyMode(BOOL standbyMode) { if (standbyMode) { lcddp_Sleep(); } else { lcddp_WakeUp(); } return LCDD_ERR_NO; } // ============================================================================ // lcddp_Sleep // ---------------------------------------------------------------------------- /// Set the main LCD screen in sleep mode. /// @return #LCDD_ERR_NO or #LCDD_ERR_NOT_OPENED // ============================================================================ PRIVATE LCDD_ERR_T lcddp_Sleep(VOID) { while (0 == lcdd_MutexGet()) { sxr_Sleep(LCDD_TIME_MUTEX_RETRY); LCDD_TRACE(TSTDOUT, 0, "LCDD: Sleep while another LCD operation in progress. Sleep %d ticks", LCDD_TIME_MUTEX_RETRY); } if (g_lcddInSleep) { lcdd_MutexFree(); return LCDD_ERR_NO; } WriteCommand_Addr(0x10); //Set Sleep In sxr_Sleep(10 MS_WAITING); LCDD_TRACE(TSTDOUT, 0, "lcddp_Sleep: calling hal_GoudaClose"); g_lcddInSleep = TRUE; hal_SpiDeActivateCs(HAL_SPI,HAL_SPI_CS0); lcdd_MutexFree(); return LCDD_ERR_NO; } // ============================================================================ // lcddp_PartialOn // ---------------------------------------------------------------------------- /// Set the Partial mode of the LCD /// @param vsa : Vertical Start Active /// @param vea : Vertical End Active /// @return #LCDD_ERR_NO, #LCDD_ERR_NOT_OPENED // ============================================================================ PRIVATE LCDD_ERR_T lcddp_PartialOn(UINT16 vsa, UINT16 vea) { return LCDD_ERR_NO; } // ============================================================================ // lcddp_PartialOff // ---------------------------------------------------------------------------- /// return to Normal Mode /// @return #LCDD_ERR_NO, #LCDD_ERR_NOT_OPENED // ============================================================================ PRIVATE LCDD_ERR_T lcddp_PartialOff(VOID) { 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 lcddp_SpiActivateCs(); WriteCommand_Addr(0x11); //Set Sleep Out sxr_Sleep(120 MS_WAITING); #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; } // ============================================================================ // lcddp_GetScreenInfo // ---------------------------------------------------------------------------- /// Get information about the main LCD device. /// @param screenInfo Pointer to the structure where the information /// obtained will be stored /// @return #LCDD_ERR_NO, #LCDD_ERR_NOT_OPENED or /// #LCDD_ERR_INVALID_PARAMETER. // ============================================================================ PRIVATE LCDD_ERR_T lcddp_GetScreenInfo(LCDD_SCREEN_INFO_T* screenInfo) { { screenInfo->width = LCDD_DISP_X; screenInfo->height = LCDD_DISP_Y; screenInfo->bitdepth = LCDD_COLOR_FORMAT_RGB_565; screenInfo->nReserved = 0; return LCDD_ERR_NO; } }