⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd_cfg.c

📁 LCD驱动代码
💻 C
📖 第 1 页 / 共 2 页
字号:
}

LOCAL LCD_OPERATIONS_T* MainLCD_GetOperationsPointer(void) 
{
	lcd_type = REFPARAM_GetLCDType();
	SCI_TRACE_LOW("MainLCD_GetOperationsPointer= %d",lcd_type);
	switch (lcd_type)
	{
		case TFT_HX8310:
			return HX8310_GetOperations();
		//case TFT_HD66773:
			//return HD66773_GetOperations();
		//case TFT_S1033:
			//return S1033_GetOperations();		
		//case TFT_R61500:
			//return R61500_GetOperations();			
		//case TFT_S0144:
			//return S0144_GetOperations();
		//case TFT_NT39102:
		 	//return NT39102_GetOperations();//爱尼雅士
		// case TFT_S0144_LIJI:
			//return S0144_GetOperations();
		case TFT_SPFD54124B:
			return SPFD54124B_GetOperations();
		case TFT_C1L5:
			return C1L5_GetOperations();
		case TFT_HX8345:                      //Truly and Liji
			return HX8345_GetOperations();
		//case TFT_C1L5_Tianma:
			//return C1L5_GetOperations();
		//case cstn_ST7669:                    //BYD
			//return ST7669_GetOperations();
		//case TFT_BF6812A:
			//return BF6812A_GetOperations();  
		case CSTN_ssd1784:
		  	return SSD1784_GetOperations();    //力科达20070911
		case CSTN_S6B33BF:
			return S6B33BF_GetOperations();      //Truly 20070911 
		
		case TFT_NT39102_dijing:                 //帝晶  NT39102  20071015
			return NT39102_Dijing_GetOperations();

       
	   // case TFT_ST7732_Liji:                   //For 立基
	   // case TFT_ST7732_Feier:                  //飞尔液晶 20070924 
			// return ST7732_GetOperations();    

		//case TFT_S6D0151_Truly:
		 	//return S6D0151_GetOperations();       //Truly 2108 20071008

		//case TFT_SPFD54124A_Weibo:                //伟博电子for 宏尚鹰 20071008
	       // return  SPFD54124A_GetOperations();

	    //case TFT_S6D0164_Weijing:                 //纬晶 20071012 QCIF
			//return S6D0164_GetOperations();
		case TFT_SPFD54124B_Zhonghang:
			return SPFD54124B_ZH_GetOperations();   //中航,20071023
		case TFT_HX8345_BYD:
			return HX8345_GetOperations();          //BYD 20071025
	        
		
		default:
			SCI_ASSERT(0); 
			return SCI_FALSE;
	}
	
}

LOCAL BOOLEAN SubLCD_Probe(void)
{
    return S1D15G24_Probe();
}

LOCAL LCD_OPERATIONS_T* SubLCD_GetOperationsPointer(void) 
{
 //   return S1D15G24_GetOperations();
}

/**---------------------------------------------------------------------------*
 **                         Functions                                      
 **---------------------------------------------------------------------------*/
PUBLIC void LCD_PointerSaveInAssertResetMode(void)
{

	*(volatile uint32 *)(g_mem_limit - 8 ) = (uint32)LCD_GetLCDPointer(MAIN_LCD_ID);
	*(volatile uint32 *)(g_mem_limit - 4 ) = (uint32)LCD_GetLCDPointer(SUB_LCD_ID);
}


PUBLIC void LCD_InitInAssertRestMode(void)
{
	SCI_TRACE_LOW("enter LCD_InitInAssertRestMode");
	LCD_SetLCDPointer(MAIN_LCD_ID, (LCD_OPERATIONS_T *)(*(volatile uint32 *)(g_mem_limit - 8)));
#ifndef NO_SUB_LCD //added by pengyuli for sublcd .
	LCD_SetLCDPointer(SUB_LCD_ID,  (LCD_OPERATIONS_T *)(*(volatile uint32 *)(g_mem_limit - 4)));
#endif
	//added by pengyuli for cr47109
	LCD_EnterSleep(MAIN_LCD_ID, SCI_FALSE);
	//DC_Init();//@David.Jia    2006.2.21   CR37755
}

/******************************************************************************/
//  Description:  Determine whether the lcd pointer is a valid LCD function pointer supported. 
//	Global resource dependence:
//  Author: Jim.zhang
//	Note:  If the input lcd pointer is the same as one of LCD supported, return SCI_FALSE,
//         else return SCI_FALSE. That means the input lcd pointer is invalide.
/******************************************************************************/
BOOLEAN LCD_IsLCDPointerValid(LCD_ID_E lcd_id, LCD_OPERATIONS_T* lcdpointer_ptr)
{
    int i;                      //@David.Jia 2006.2.21 CR37755 begin
    
	if (MAIN_LCD_ID == lcd_id)
	{
	    for (i = 0; i < MAX_MAIN_LCD_SUPPORT; i++)
	    { 
		    if (lcdpointer_ptr == lcd_probe[i].get_operations())  
		    {
			    return SCI_TRUE;
		    }
		}	
	}
	else //sub lcd 
	{
		for (i = 0; i < MAX_SUB_LCD_SUPPORT; i++)
	    { 
		    if (lcdpointer_ptr == sublcd_probe[i].get_operations())  
		    {
			    return SCI_TRUE;
			}
		}	
	}
	
	return SCI_FALSE;           //@David.Jia 2006.2.21 CR37755 end	
}

/******************************************************************************/
//  Description:  let the main lcd display on to display assert information 
//	Global resource dependence:
//  Author: Jim.zhang
//	Note:
/******************************************************************************/
PUBLIC void LCD_DisplayOn(void)
{
	// exit sleep mode
	LCD_EnterSleep(MAIN_LCD_ID, SCI_FALSE);

	// enter by pass mode if have digital cammera
	GPIO_SetCameraByPassMode(SCI_TRUE);

	// open back light.
    GPIO_SetLcdBackLight(SCI_TRUE);
}

/******************************************************************************/
//  Description:  return the main lcd buffer  pointer
//	Global resource dependence:
//  Author: Jim.zhang
//	Note:
/******************************************************************************/
PUBLIC void *LCD_GetLCDBuffer(void)
{
	return g_lcd_buffer;		
}

/******************************************************************************/
//  Description:  return the sub lcd buffer pointer
//	Global resource dependence:
//  Author: Jim.zhang
//	Note:
/******************************************************************************/
PUBLIC void *LCD_GetSubLCDBuffer(void)
{
	return g_sublcd_buffer;
}


/******************************************************************************/
//  Description:  return the main lcd driver funtion pointer
//	Global resource dependence:
//  Author: Jim.zhang
//	Note:
/******************************************************************************/
PUBLIC LCD_OPERATIONS_T *LCD_GetOperations(void)
{
	uint16 i;	
	
	for(i=0; i<MAX_MAIN_LCD_SUPPORT; i++)
	{
		if( lcd_probe[i].probe() )
		{
			return( lcd_probe[i].get_operations() );
		}
	}
	
	return ( lcd_probe[0].get_operations() );
}

/******************************************************************************/
//  Description:  return the sub lcd driver funtion pointer
//	Global resource dependence:
//  Author: Jim.zhang
//	Note:
/******************************************************************************/
PUBLIC LCD_OPERATIONS_T *SubLCD_GetOperations(void)
{
    uint16 i;
#ifdef NO_SUB_LCD
	return (PNULL);
#else
	for(i=0; i<MAX_SUB_LCD_SUPPORT; i++)
	{
		if( sublcd_probe[i].probe() )
		{
			return( sublcd_probe[i].get_operations() );
		}
	}	
	return ( sublcd_probe[0].get_operations() );
#endif
}

/******************************************************************************/
//  Description:  return the sub lcd driver funtion pointer
//	Global resource dependence:
//  Author: Jim.zhang
//	Note:
/******************************************************************************/
PUBLIC int LCD_RefreshControl (int flag)
{
	Refreshflag = flag;
	return Refreshflag;
}
/******************************************************************************/
//  Description:  return the sub lcd driver funtion pointer
//	Global resource dependence:
//  Author: Jim.zhang
//	Note:
/******************************************************************************/
PUBLIC int LCD_GetRefreshFlag ()
{
	return Refreshflag;
}

/******************************************************************************/
//  Description:  delay n ms to sync.
//	Global resource dependence:
//  Author:Pengyu.li
//	Note:
/******************************************************************************/
void Delayms (uint32 ms)	
{
	uint32 t1, t2;
	
	//if a thread  call this function
	if(SCI_INVALID_BLOCK_ID != SCI_IdentifyThread())
	{
		SCI_Sleep(ms);
	}
	else //if a non thread call this function.
	{       
		t1 = t2 = SCI_GetTickCount ();
	
		do{
			t2 = SCI_GetTickCount ();
		}while ((t2-t1) < ms);
	}
}

/******************************************************************************/
//  Description: Get lcm id by reading adc value.
//	Global resource dependence:
//  Author:Pengyu.li
//	Note:
/******************************************************************************/
PUBLIC uint32 LCD_GetADCValue(uint8 adc_idx)
{
#define ADC_NUM 10
    uint32 i, adc_val = 0, adc_sum = 0;
    
    //open adc in1 .
	for(i =0 ; i < 3; i++)
	{
		ADC_CLEAR_INT_FLAG;
		ADC_START( 1u << adc_idx );
		ADC_WAIT_COMPLETED();
		ADC_CLEAR_INT_FLAG;		
	}	
	
	//get adc value of lcm id in ten times.
	for(i=0; i<ADC_NUM; i++)
	{
		ADC_CLEAR_INT_FLAG;        
		ADC_START( 1u << adc_idx );
	  	ADC_WAIT_COMPLETED();       
		adc_val = ADC_RESULT; //one time 
	    ADC_CLEAR_INT_FLAG;
	    	     
	    adc_sum += adc_val;
	    SCI_TRACE_LOW("adc_rlt[%d]: %d", i, adc_val);	   
	}
	
	ADC_STOP;
	
	adc_val = adc_sum / ADC_NUM;	
		
	return adc_val;
}
/**---------------------------------------------------------------------------*
 **                         Compiler Flag                                     *
 **---------------------------------------------------------------------------*/
#ifdef   __cplusplus
    }
#endif 
// end lcd_cfg.c

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -