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

📄 cstn_s6b33b5a.c

📁 展讯平台多款LCD驱动:cstn_nt7526/cstn_S1D15G24/cstn_S6B33B5A
💻 C
📖 第 1 页 / 共 2 页
字号:
		S6B33B5A_Command(0x09);
		waitms(20);		
		S6B33B5A_Command(0x26);
		S6B33B5A_Command(0x0b);
		waitms(20);		
		S6B33B5A_Command(0x26);
		S6B33B5A_Command(0x0f);
		waitms(20);		
		S6B33B5A_Command(0x51);
		waitms(200);		
	}
	return ERR_LCD_NONE;
}

/*****************************************************************************/
//  Description:    
//	Global resource dependence: 
//  Author:         Jing.Li
//	Note:
/*****************************************************************************/
LOCAL ERR_LCD_E   S6B33B5A_SetContrast(
	uint16  contrast	//contrast value to set
	)
{
	S6B33B5A_Command(S6B33B5A_CONTRAST_CONTROL_MODE_0);
	S6B33B5A_Command(contrast);
	waitms(100);
	
	return ERR_LCD_NONE;
} 

/*****************************************************************************/
//  Description:    
//	Global resource dependence: 
//  Author:         Jing.Li
//	Note:
/*****************************************************************************/
LOCAL ERR_LCD_E   S6B33B5A_SetBrightness(
	uint16 brightness	//birghtness to set
	)
{
	return ERR_LCD_FUNC_NOT_SUPPORT;
}

/*****************************************************************************/
//  Description:    
//	Global resource dependence: 
//  Author:         Jing.Li
//	Note:
/*****************************************************************************/
LOCAL ERR_LCD_E S6B33B5A_SetDisplayWindow(
	uint16 left, 		//left of the window
	uint16 top,			//top of the window
	uint16 right,		//right of the window
	uint16 bottom		//bottom of the window
	)
{
	return ERR_LCD_FUNC_NOT_SUPPORT;
}

ERR_LCD_E S6B33B5A_InvalidateRect_image(
	uint16 left, 	//the left value of the rectangel
	uint16 top, 	//top of the rectangle
	uint16 right, 	//right of the rectangle
	uint16 bottom,	//bottom of the rectangle
	uint16 *buf_ptr,
	uint8  is_invert
	)
{
	return ERR_LCD_NONE;
}

/*****************************************************************************/
//  Description:    
//	Global resource dependence: 
//  Author:         Jing.Li
//	Note:
/*****************************************************************************/
LOCAL ERR_LCD_E S6B33B5A_InvalidateRect(
	uint16 left, 	//the left value of the rectangel
	uint16 top, 	//top of the rectangle
	uint16 right, 	//right of the rectangle
	uint16 bottom	//bottom of the rectangle
	)
{
	uint32 i, j;
//	uint32 dummy_before, dummy_after;
//	uint32 row, column;
	uint16 *buf_ptr = (uint16 *)LCD_GetSubLCDBuffer();
	uint16	color = 0x00;
	

  	left 	= (left >= S6B33B5A_WIDTH)    ? S6B33B5A_WIDTH-1 : left;
	right 	= (right >= S6B33B5A_WIDTH)   ? S6B33B5A_WIDTH-1 : right;
	top 	= (top >= S6B33B5A_HEIGHT)    ? S6B33B5A_HEIGHT-1 : top;
	bottom 	= (bottom >= S6B33B5A_HEIGHT) ? S6B33B5A_HEIGHT-1 : bottom;

	if ( ( right < left ) || ( bottom < top ) )
	{
		//SCI_TRACE_LOW(" HD66773_invalidate_rect wrong: right > left or bottom > top");
		return ERR_LCD_PARAMETER_WRONG;
	}
 
	/*-------set display area-----------*/
	S6B33B5A_Command(S6B33B5A_ROW_ADDRESS_AREA);
	S6B33B5A_Command(left);	
	S6B33B5A_Command(right);	

	S6B33B5A_Command(S6B33B5A_COL_ADDRESS_AREA);
	S6B33B5A_Command(top);	
	S6B33B5A_Command(bottom);	

	//command of write display data to sub lcd
	
	for (j = top; j <= bottom; j++)
	{	
		for (i = left; i <= right; i++)	// real write 
		{
			color = *(buf_ptr + j * S6B33B5A_WIDTH + i);
			//S1D15G24_Data(color);
			//SCI_TRACE_LOW("#####S1D15G24_InvalidateRec color = %x", color);
		// for 8bit
			S6B33B5A_Data((uint8)((color & 0xFF00) >> 8));	
			S6B33B5A_Data((uint8)(color & 0x00FF));	
  		//  S6B33B5A_Data(color);	//for 16bit
		}
	}	
	
	return ERR_LCD_NONE;
}

/*****************************************************************************/
//  Description:    
//	Global resource dependence: 
//  Author:         Jing.Li
//	Note:
/*****************************************************************************/
LOCAL ERR_LCD_E S6B33B5A_Invalidate(void)
{
	uint32 i;
	uint16 *buf_ptr = (uint16 *)LCD_GetSubLCDBuffer();
	uint16	color = 0x00;
	//SCI_TRACE_LOW("#####################S1D15G24_InvalidateRect#############################");

	/*-------set display area-----------*/
	S6B33B5A_Command(S6B33B5A_ROW_ADDRESS_AREA);
	S6B33B5A_Command(S6B33B5A_ROW_ADDRESS_AREA_START);	
	S6B33B5A_Command(S6B33B5A_ROW_ADDRESS_AREA_END);	

	S6B33B5A_Command(S6B33B5A_COL_ADDRESS_AREA);
	S6B33B5A_Command(S6B33B5A_COL_ADDRESS_AREA_START);	
	S6B33B5A_Command(S6B33B5A_COL_ADDRESS_AREA_END);	

	//command of write display data to sub lcd
	
	for(i=0;i<(S6B33B5A_WIDTH*S6B33B5A_HEIGHT);i++)
	{
	    color = *buf_ptr++;
	    
	 // for 8bit
	    S6B33B5A_Data((uint8)color>>8);	
	    S6B33B5A_Data((uint8)(color & 0x00FF));	
	 // for 16bit
   //     S6B33B5A_Data(color);
	}

	return ERR_LCD_NONE;
}

/*****************************************************************************/
//  Description:    
//	Global resource dependence: 
//  Author:         Jing.Li
//	Note:
/*****************************************************************************/
PUBLIC void S6B33B5A_Close(void)
{
    S6B33B5A_Command(S6B33B5A_DISPLAY_OFF);
    //S1D15G24_Command(0x10);
    waitms(100);
}

static LCD_SPEC_T g_S6B33B5A_spec =
{
	0,		//uint8	rgb_sequence; 		/*rgb sequence*/
										/*0: R-G-B, 1: B-G-R*/
	10,		//uint8	min_cycle_read;		/*read cycle:  ns*/
	50,		//uint8	min_cycle_write;	/*write cycle: ns*/
	0,		//uint8	cyclenum_sendaddr;	/*operation cycle to send address*/
										/* 0: once, 1:twice*/
	0,		//uint8	cyclenum_senddata;	/*operation cycle to send data */
										/* 0; once, 1:twice*/
	1,		//uint8	cmd_num_setupwin;	/*command number to settint up widnow space*/
										/*0: 4 commands for setting up window space: x-start, x-end, y-start, y-end*/
										/*1: 2 commands for setting up window space: x-address, y-address*/
										/*2: 1 commanns for setting up window space window address*/
										/*3: no commands for setting up window space*/
	1,		//uint8	method_send_cmdaddr;/*how to send command & address*/
										/*0: sending together, 1:sending separately*/
	1,		//uint8	ads_is_high;		/*status of ADS when sending parameter*/
										/*0: low, 1: high*/
	0,		//uint8	sequence_cmdaddr;	/*the sequence of command & address, if not send command & address together as 16 bits*/
										/*0: write 2 window area on a 16bit bus, Hitachi*/
										/*1, write 1 sindow area with one command, Casio*/
										/*2, write 1 command and 2 parameters separately, Samsung*/
										/*3, reserved*/
										/*4, write 1 command, 2 parameters for page, 4 parameters for column, Epson*/
										/*5, write 1 command, 4 parameters for page, 2 parameters for column*/
										/*6, write 1 command, write 4 parameters for each page/column*/
	4,		//uint8	cyclenum_setupwin;	/*operation cycle to set up window*/
	1,		//uint8	method_gram_access;	/*select method to begin actul data read/write address for selected window area in GRAM*/
										/*0: without any assigning x/y address, use initial start address of window*/
										/*1: assign 1 x/y set command and parameter onto 16bit bus at onece*/
										/*2: use separate for X and Y, with upper byte consists of command and lower byte for parameter*/
										/*3, 1 command for selecting X/Y adn 2 parameters, us command and parameter separately*/
										/*4, set different command for x and y, and command and parameter differs*/
	1,		//uint8	sequence_gram_access;/*read/write command and sequence for GRAM*/
										/*0: perform read/write without seperate read/write command but by strobe 'high' ADS(RS)pin, samsung*/
										/*1: data cycle comes right afer read/write command, Toshiba/Matsushita/Hitachi/NEC*/
										/*2: after read/write command follows start address parameter for X and Y and follows data cycle, Casio*/
										/*3: similiar to 2 but sends X and Y parameters together on 16 bit BUS*/
	0,		//uint8	order_xy;			/*order of x and y address, I think, this field is active when sequence_gram_access = 2*/
										/*0: X first*/
										/*1: Y first*/
	1,		//uint8	is_dummy_read;		/*deciding first read data when reading GRAM*/
										/*0: acknowledge first data as valid data*/
										/*1: acknowledge first data as dummy data*/
	3,		//uint8	cyclenum_read;		/*total cycle numbers needed to access GRAM read/write*/
	0x16,	//uint8	win_setstartx_cmd;	/*window x start address set command*/
	0x00,	//uint8	win_setendx_cmd;	/*window x end address set command*/
	0x17,	//uint8	win_setstarty_cmd;	/*window y start address set command*/
	0x00,	//uint8	win_setendy_cmd;	/*window y end address set command*/
	0x21,	//uint8	gram_setx_cmd;		/*gram x address set command*/
	0x00,	//uint8	gram_sety_cmd;		/*gram y address set command*/
	0x22,	//uint8	gram_read_cmd;		/*gram read command*/
	0x22,	//uint8	gram_write_cmd;		/*gram write command*/
	//@zhemin.lin, add 1 line, CR9590
	0x00,	//uint8	line_offset;		/*line offset for display on lcd*/
	0x00	//uint8 colum_offset        /*columoffset for display on lcd*/
};

/*****************************************************************************/
//  Description:    
//	Global resource dependence: 
//  Author:         Jing.Li
//	Note:
/*****************************************************************************/
LOCAL ERR_LCD_E  S6B33B5A_GetMainLcdSpec(
	LCD_SPEC_T *spec_ptr 	//spec struct pointer
	)
{
	if (spec_ptr == PNULL)
	{
		return 1;
	}
	
	memcpy(spec_ptr, &g_S6B33B5A_spec, sizeof(LCD_SPEC_T));
	
	return ERR_LCD_NONE;
}


LOCAL LCD_OPERATIONS_T S6B33B5A_operations = 
{
	S6B33B5A_Init,
	S6B33B5A_EnterSleep,
	S6B33B5A_SetContrast,
	S6B33B5A_SetBrightness,
	S6B33B5A_SetDisplayWindow,
	S6B33B5A_GetInfo,
	S6B33B5A_InvalidateRect,
	S6B33B5A_InvalidateRect_image,
	S6B33B5A_Invalidate,
	S6B33B5A_Clear,
	S6B33B5A_Close,
	S6B33B5A_GetMainLcdSpec
};

/*****************************************************************************/
//  Description:    
//	Global resource dependence: 
//  Author:         Jing.Li
//	Note:
/*****************************************************************************/
PUBLIC LCD_OPERATIONS_T* S6B33B5A_GetOperations(void)
{
	return &S6B33B5A_operations;
}


int sio_trace( const char * msg )
{
    int  i;
    
    //return 1;
    
    if( NULL == msg )
        return 0;
        
    while( *msg )
    {
    	*(volatile uint32 *)(getRMUartBaseAddr()) = *msg++;
    }
    
    for( i = 0; i < 1000; i++ ) 
    {  	; }
    
    return 1;
}
/*****************************************************************************/
//  Description:    
//	Global resource dependence: 
//  Author:         Jing.Li
//	Note:
/*****************************************************************************/
PUBLIC BOOLEAN S6B33B5A_Probe(void)
{
	return SCI_TRUE;	
//	uint8 status = 0x00;
	
    /*
    S6B33B5A_Reset();
     
    S6B33B5A_Command(S6B33B5A_DISPLAY_OFF);
	waitms(500);
	status = (*(volatile uint16 *)0x58010000);
	if((status & 0x01) != 0) 
	{
	    SCI_TRACE_LOW("NOT S6B33B5A 1: %x", status);
	    return SCI_FALSE;
	}
	
	
	S6B33B5A_Command(S6B33B5A_DISPLAY_ON);
	waitms(500);
	status = (*(volatile uint16 *)0x58010000);
	if((status & 0x01) == 0) 
	{
	    SCI_TRACE_LOW("NOT S6B33B5A 2: %x", status);
	    return SCI_FALSE;
	}
	
	
	return SCI_TRUE;
	*/
}


⌨️ 快捷键说明

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