基于单片机的图形控制芯片——瑞佑(RAIO)RA8889系列介绍(四)——软件篇

瑞佑(RAIO)RA8889系列介绍(四)——软件篇

上一节我主要介绍了单片机通过RA8889来点液晶屏的硬件结构,接下来开始讲解软件部份如何设计。

瑞佑(RAIO)的RA8875当前已经拥有相当巨大的用户群,一个最重要的原因是其软件代码特别容易写,而RA8889也一样,功能上比RA8875更强大但是软件代码一样简单,而且还会更容易!

列举:main.c
#include 
#include 
#include 

#include "delay.h"

//Include RAiO files
#include "UserDef.h"
#include "RA8889_MCU_IF.h"
#include "RA8889.h"
#include "RA8889_API.h"	
#include "API_Demo.h"

int main(void)
{
	RA8889_Initial();	//RA8889初始化
	BTE_Solid_Fill(0,4800,0,0,0x000000,800,480);	//内存清空,填充
	while(1)
	{
		NOR_AVI_Demo();		//执行AVI播放演示
	}
}
RA8889_Initial() 初始化函数
//==============================================================================
void RA8889_Initial(void)
{
#ifdef Parallel_8080 
	/* using STM32 FSMC Interface*/ 
#endif

#ifdef Parallel_6800
	Parallel_6800_ini();
#endif

#ifdef Serial_I2C
	I2C_Initial();        
#endif

#ifdef Serial_4
	SPI4_Init();
#endif

#ifdef Serial_3
	SPI3_Init();
#endif


//------------------------------------
	RA8889_HW_Reset();
	Check_IC_ready();
//	System_Check_Temp();  


	RA8889_SW_Reset();
	Check_IC_ready();


//------------------------------------
	RA8889_PLL(DRAM_FREQ, CORE_FREQ, SCAN_FREQ);

//------------------------------------	
	RA8889_SDRAM_initial();// set the SDRAM parameter.  
//------------------------------------

//**[01h]**//
	TFT_24bit();
//	TFT_18bit();
//	TFT_16bit();
//	Without_TFT();

//**[01h]**//
#if defined (MCU_8bit_ColorDepth_8bpp) || defined (MCU_8bit_ColorDepth_16bpp) || defined (MCU_8bit_ColorDepth_24bpp)	
	Host_Bus_8bit();
#endif

#if defined (MCU_16bit_ColorDepth_16bpp) || defined (MCU_16bit_ColorDepth_24bpp_Mode_1) || defined (MCU_16bit_ColorDepth_24bpp_Mode_2)	
	Host_Bus_16bit();
#endif


//------------------------------------
//**[02h]**//
	#ifdef MCU_8bit_ColorDepth_8bpp	
	Data_Format_8b_8bpp();
	#endif
	#ifdef MCU_8bit_ColorDepth_16bpp	
	Data_Format_8b_16bpp();
	#endif
	#ifdef MCU_8bit_ColorDepth_24bpp	
	Data_Format_8b_24bpp();
	#endif

	#ifdef MCU_16bit_ColorDepth_16bpp	
	Data_Format_16b_16bpp();
	#endif
	#ifdef MCU_16bit_ColorDepth_24bpp_Mode_1	
	Data_Format_16b_24bpp_mode1();
	#endif
	#ifdef MCU_16bit_ColorDepth_24bpp_Mode_2	
	Data_Format_16b_24bpp_mode2();
	#endif

	
	MemWrite_Left_Right_Top_Down();//(Default) Memory Write: Left to Right, Top to Down.

//------------------------------------
//**[03h]**//

	Graphic_Mode();
//	Text_Mode();

	Memory_Select_SDRAM();

//------------------------------------
//** Set color depth, define in [UserDef.h] **//

	#ifdef MCU_8bit_ColorDepth_8bpp	
		Select_Main_Window_8bpp();		//[10h] Set main window color depth
		Memory_8bpp_Mode();				//[5Eh] Set active memory color depth

		Select_PIP1_Window_8bpp();		//[11h] PIP 1 Window Color Depth
		Select_PIP2_Window_8bpp();		//[11h] PIP 2 Window Color Depth

		BTE_S0_Color_8bpp();			//[92h] Source_0 Color Depth
		BTE_S1_Color_8bpp();			//[92h] Source_1 Color Depth
		BTE_Destination_Color_8bpp();	//[92h] Destination Color Depth	
		
		IDEC_Destination_Color_8bpp();//
	#endif

	#if defined (MCU_8bit_ColorDepth_16bpp) || defined (MCU_16bit_ColorDepth_16bpp)
		Select_Main_Window_16bpp();		//[10h]Set main window color depth
		Memory_16bpp_Mode();			//[5Eh]Set active memory color depth

		Select_PIP1_Window_16bpp();		//[11h] PIP 1 Window Color Depth
		Select_PIP2_Window_16bpp();		//[11h] PIP 2 Window Color Depth

		BTE_S0_Color_16bpp();			//[92h] Source_0 Color Depth
		BTE_S1_Color_16bpp();			//[92h] Source_1 Color Depth
		BTE_Destination_Color_16bpp();	//[92h] Destination Color Depth	 
		
		IDEC_Destination_Color_16bpp();//
	#endif

	#if defined (MCU_8bit_ColorDepth_24bpp) || defined (MCU_16bit_ColorDepth_24bpp_Mode_1) || defined (MCU_16bit_ColorDepth_24bpp_Mode_2)	
		Select_Main_Window_24bpp();		//[10h]Set main window color depth
		Memory_24bpp_Mode();			//[5Eh]Set active memory color depth

		Select_PIP1_Window_24bpp();		//[11h] PIP 1 Window Color Depth
		Select_PIP2_Window_24bpp();		//[11h] PIP 2 Window Color Depth

		BTE_S0_Color_24bpp();			//[92h] Source_0 Color Depth
		BTE_S1_Color_24bpp();			//[92h] Source_1 Color Depth
		BTE_Destination_Color_24bpp();	//[92h] Destination Color Depth	   
		
		IDEC_Destination_Color_24bpp();//
	#endif

//------------------------------------
//**[12h]~[1Fh]]**//
	Set_LCD_Panel(); // define in [UserDef.h]

//------------------------------------
//**[20h][21h][22h][23h]**//
	Main_Image_Start_Address(0);
//**[24h][25h]**//					
	Main_Image_Width(main_image_width);							
//**[26h][27h][28h][29h]**//
	Main_Window_Start_XY(0,0);	
//**[50h][51h][52h][53h]**//
	Canvas_Image_Start_address(0);
//**[54h][55h]**//
	Canvas_image_width(canvas_image_width);
//**[56h][57h][58h][59h]**//
	Active_Window_XY(0,0);
//**[5Ah][5Bh][5Ch][5Dh]**//
	Active_Window_WH(LCD_width,LCD_legth);

//------------------------------------
//**[5E]**//
	Memory_XY_Mode();
//	Memory_Linear_Mode();


//------------------------------------
	Set_Serial_Flash_IF();

//------------------------------------
//**[5Fh][60h][61h][62h]**//
	Goto_Pixel_XY(0,0);	   

//------------------------------------  

	//---------------------//
	Display_ON();
	//---------------------//
	//Color_Bar_ON();
	//delay_seconds(1);
	//Color_Bar_OFF();
}
BTE_Solid_Fill() 颜色填充函数:
void BTE_Solid_Fill
(
unsigned long Des_Addr //start address of destination 
,unsigned short Des_W // image width of destination (recommend = canvas image width) 
, unsigned short XDes //coordinate X of destination 
,unsigned short YDes //coordinate Y of destination 
,unsigned long Foreground_color //Solid Fill color
,unsigned short X_W //Width of BTE Window
,unsigned short Y_H //Length of BTE Window 
)
{

#ifdef MCU_8bit_ColorDepth_8bpp	
  Foreground_color_256(Foreground_color);
#endif
#ifdef MCU_8bit_ColorDepth_16bpp	
  Foreground_color_65k(Foreground_color);
#endif
#ifdef MCU_8bit_ColorDepth_24bpp	
  Foreground_color_16M(Foreground_color);
#endif

#ifdef MCU_16bit_ColorDepth_16bpp	
  Foreground_color_65k(Foreground_color);
#endif
#ifdef MCU_16bit_ColorDepth_24bpp_Mode_1	
  Foreground_color_16M(Foreground_color);
#endif
#ifdef MCU_16bit_ColorDepth_24bpp_Mode_2	
  Foreground_color_16M(Foreground_color);
#endif
  BTE_Destination_Memory_Start_Address(Des_Addr);
  BTE_Destination_Image_Width(Des_W);
  BTE_Destination_Window_Start_XY(XDes,YDes);
  BTE_Window_Size(X_W,Y_H);
  BTE_Operation_Code(0x0c);		//BTE Operation: Solid Fill (w/o ROP)
  BTE_Enable();
  Check_BTE_Busy();  
}
NOR_AVI_Demo() 播放AVI影片函数:
void NOR_AVI_Demo(void)
{
	unsigned char temp;
SPI_NOR_initial_JPG_AVI (1,0,1,2,1);
AVI_NOR(1296674,13327214,shadow_buff,shadow_buff+2400,0,0,322,548,canvas_image_width);
AVI_window(1);
	
do{	
		temp = Read_Media_Decode_Busy();	//read busy flag to know media decode busy or idle
	}while(temp&0x40);
AVI_window(0);
}

瑞佑(RAIO)的工程师们已经化繁为简,所有功能都打包成API函数了,简单明了,用户不需要去查阅繁琐的寄存器功能,相信这一点足以减少巨大的UI开发时间。

瑞佑(RAIO)的API包含描点、几何绘图、文字显示、图形运算(BTE逻辑运算)、DMA调图显示以及AVI影片播放等等各种功能,可以满足人机交互的所有界面设计需求。

许多单片机自带TFT液晶控制器,那种方案正常要结合GUI来设计界面,是直接描点显示,界面图形都是通过软件来完成,在许多情况下显示速度就会慢一些了,而这点在RA8889上就可以得到克服,哪怕您使用的只是一颗51单片机,显示速度一样十分迅速,因为这颗芯片内部是通过硬件来完成图形驱动控制的。

RA8889_API.h 接口函数文件
   /*************** RAIO Technology Inc. ***************
  * file		: RA8889_API.h
  * author		: RAIO Application Team ^v^ 
  * version		: V1.0  
  * date		: 2020/04/21 
  * brief		: 	
	* RAIO copyright
  ****************************************************/	

#define nand_buff 13824000
#define shadow_buff 6912000

void MPU8_8bpp_Memory_Write (unsigned short x,unsigned short y,unsigned short w ,unsigned short h ,const unsigned char *data);
void MPU8_16bpp_Memory_Write (unsigned short x,unsigned short y,unsigned short w ,unsigned short h ,const unsigned char *data);
void MPU8_24bpp_Memory_Write (unsigned short x,unsigned short y,unsigned short w ,unsigned short h ,const unsigned char *data);
void MPU16_16bpp_Memory_Write (unsigned short x,unsigned short y,unsigned short w ,unsigned short h ,const unsigned short *data);
void MPU16_24bpp_Mode1_Memory_Write (unsigned short x,unsigned short y,unsigned short w ,unsigned short h ,const unsigned short *data);
void MPU16_24bpp_Mode2_Memory_Write (unsigned short x,unsigned short y,unsigned short w ,unsigned short h ,const unsigned short *data);

	 
void PIP(unsigned char On_Off, unsigned char Select_PIP,unsigned long PAddr,unsigned short XP,unsigned short YP,unsigned long ImageWidth,unsigned short X_Dis,unsigned short Y_Dis,unsigned short X_W,unsigned short Y_H);

void Print_Internal_Font_Hexvariable(unsigned short x,unsigned short y,unsigned short X_W,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor,  unsigned int tmp2);
void Print_Internal_Font_Decimalvariable(unsigned short x,unsigned short y,unsigned short X_W,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor,unsigned int tmp2);
void Print_Internal_Font_String(unsigned short x,unsigned short y,unsigned short X_W,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor, char tmp2[]);
void Print_BIG5String(unsigned char Clk ,unsigned char BUS,unsigned char SCS,unsigned short x ,unsigned short y ,unsigned short X_W ,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor,char *tmp2);
void Print_GB2312String(unsigned char Clk,unsigned char BUS,unsigned char SCS,unsigned short x,unsigned short y,unsigned short X_W,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor,char *tmp2);
void Print_GB12345String(unsigned char Clk,unsigned char BUS,unsigned char SCS,unsigned short x,unsigned short y,unsigned short X_W,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor,char tmp2[]);
void Print_UnicodeString(unsigned char Clk,unsigned char BUS,unsigned char SCS,unsigned short x,unsigned short y,unsigned short X_W,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor,unsigned short *tmp2);
void Select_Font_Height_WxN_HxN_ChromaKey_Alignment(unsigned char Font_Height,unsigned char XxN,unsigned char YxN,unsigned char ChromaKey,unsigned char Alignment);
void Show_String(char *str);


void Draw_Line(unsigned long LineColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2);
void Draw_Triangle(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3);
void Draw_Triangle_Fill(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3);
void Draw_Circle(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short R);
void Draw_Circle_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short R);
void Draw_Ellipse(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Ellipse_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Left_Up_Curve(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Left_Up_Curve_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Right_Down_Curve(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Right_Down_Curve_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Right_Up_Curve(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Right_Up_Curve_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Left_Down_Curve(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Left_Down_Curve_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Square(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2);
void Draw_Square_Fill(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2);
void Draw_Circle_Square(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short R,unsigned short Y_R);
void Draw_Circle_Square_Fill(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short R,unsigned short Y_R);


void BTE_Memory_Copy(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned short X_W,unsigned short Y_H);
void BTE_Memory_Copy_Chroma_key(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned long Background_color,unsigned short X_W,unsigned short Y_H);
void BTE_MCU_Write_MCU_8bit(unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned short X_W,unsigned short Y_H,const unsigned char *data);
void BTE_MCU_Write_MCU_16bit(unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned short X_W,unsigned short Y_H,const unsigned short *data);
void BTE_MCU_Write_Chroma_key_MCU_8bit(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned long Background_color,unsigned short X_W,unsigned short Y_H,const unsigned char *data);
void BTE_MCU_Write_Chroma_key_MCU_16bit(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned long Background_color,unsigned short X_W,unsigned short Y_H,const unsigned short *data);
void BTE_Memory_Copy_ColorExpansion(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color,unsigned long Background_color);
void BTE_Memory_Copy_ColorExpansion_Chroma_key(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color);
void BTE_MCU_Write_ColorExpansion_MCU_8bit(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color,unsigned long Background_color,const unsigned char *data);
void BTE_MCU_Write_ColorExpansion_MCU_16bit(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color,unsigned long Background_color,const unsigned short *data);
void BTE_MCU_Write_ColorExpansion_Chroma_key_MCU_8bit(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color,const unsigned char *data);
void BTE_MCU_Write_ColorExpansion_Chroma_key_MCU_16bit(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color,const unsigned short *data);
void BTE_Pattern_Fill(unsigned char P_8x8_or_16x16, unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned short X_W,unsigned short Y_H);
void BTE_Pattern_Fill_With_Chroma_key(unsigned char P_8x8_or_16x16 ,unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned long Background_color,unsigned short X_W,unsigned short Y_H);
void BTE_Solid_Fill(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned long Foreground_color,unsigned short X_W,unsigned short Y_H);
void BTE_Alpha_Blending_Picture_Mode(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned char alpha);



void PWM0(unsigned char on_off, unsigned char Clock_Divided, unsigned char Prescalar, unsigned short Count_Buffer,unsigned short Compare_Buffer);
void PWM1(unsigned char on_off, unsigned char Clock_Divided, unsigned char Prescalar, unsigned short Count_Buffer,unsigned short Compare_Buffer);

void Print_Hex(unsigned char buf);


void putPixel(unsigned short x,unsigned short y,unsigned long color);
void lcdPutChar8x12(unsigned short x,unsigned short y,unsigned long fgcolor,unsigned long bgcolor, unsigned char bg_transparent,unsigned char code);
void lcdPutString8x12(unsigned short x,unsigned short y, unsigned long fgcolor, unsigned long bgcolor,unsigned char bg_transparent,char *ptr);
void lcdPutChar16x24(unsigned short x,unsigned short y,unsigned long fgcolor,unsigned long bgcolor,unsigned char bg_transparent,unsigned char code);
void lcdPutString16x24(unsigned short x,unsigned short y, unsigned long fgcolor, unsigned long bgcolor,unsigned char bg_transparent,char *ptr);
void lcdPutChar32x48(unsigned short x,unsigned short y,unsigned long fgcolor,unsigned long bgcolor,unsigned char bg_transparent,unsigned char code);
void lcdPutString32x48(unsigned short x,unsigned short y, unsigned long fgcolor, unsigned long bgcolor,unsigned char bg_transparent,char *ptr);



void SPI_NAND_initial_DMA (unsigned char SCS , unsigned char BUS);
void SPI_NAND_initial_JPG_AVI (unsigned char BUS,unsigned char SCS,unsigned char SCK_Divide);
void AVI_NAND(unsigned long addr,unsigned long videosize,unsigned long shadow_buffer_addr, unsigned long PIP_buffer_addr,unsigned long x,unsigned long y,unsigned long height,unsigned long width,unsigned long PIP_canvas_Width);
void JPG_NAND (unsigned long addr,unsigned long JPGsize,unsigned long IDEC_canvas_width, unsigned short x,unsigned short y);
void SPI_NAND_DMA_png (unsigned long dma_page_addr,unsigned long pic_buffer_Layer,unsigned long Show_pic_Layer,unsigned int picture_Width,unsigned int picture_Height);
void SPI_NAND_DMA (unsigned long dma_page_addr,unsigned long X_coordinate,unsigned long Y_coordinate,unsigned long des_canvas_width,unsigned int picture_Width,unsigned int picture_Height,unsigned long pic_buffer_Layer,unsigned long Show_pic_Layer,unsigned char chorma,unsigned long Background_color);

void DMA_24bit(unsigned char Clk ,unsigned short X1,unsigned short Y1,unsigned short X_W,unsigned short Y_H ,unsigned short P_W ,unsigned long Addr);
void DMA_32bit(unsigned char Clk ,unsigned short X1,unsigned short Y1,unsigned short X_W,unsigned short Y_H ,unsigned short P_W,unsigned long Addr);
void switch_24bits_to_32bits(unsigned char BUS,unsigned char SCS);

void SPI_NOR_Flash_switch_QUAD_MODE(unsigned char BUS,unsigned char SCS,unsigned char flash);
void SPI_NOR_initial_DMA (unsigned char mode,unsigned char BUS,unsigned char SCS,unsigned char flash,unsigned char addr_24b_32b);
void SPI_NOR_initial_JPG_AVI (unsigned char flash,unsigned char addr_24b_32b,unsigned char BUS,unsigned char SCS,unsigned char SCK_Divide);
void SPI_NOR_DMA_png (unsigned long dma_page_addr,unsigned long pic_buffer_Layer,unsigned long Show_pic_Layer,unsigned int picture_Width,unsigned int picture_Height);

void JPG_NOR (unsigned long addr,unsigned long JPGsize,unsigned long IDEC_canvas_width,unsigned short x,unsigned short y);
void AVI_NOR(unsigned long addr,unsigned long videosize,unsigned long shadow_buffer_addr,unsigned long PIP_buffer_addr,unsigned long x,unsigned long y,unsigned long height,unsigned long width,unsigned long PIP_width);

void BTE_alpha_blending_32bit_Pixel_mode(unsigned int picture_Width,unsigned int BTE_X,unsigned int BTE_Y,unsigned long S0X,unsigned long S0Y,unsigned long S0_Start_Addr,unsigned long S0_canvas_width,unsigned long desX,unsigned long desY,unsigned long DES_Start_Addr,unsigned long DES_canvas_width,unsigned long pic_buffer_Layer);

void AVI_window(unsigned char ON_OFF);

看到这里,相信许多工程师已对这颗芯片的软件设计理解了一大半了。可能大家还有个疑问,液晶屏型号那么多,初始化肯定各有所异,如何设置呢?头大!这个也要告诉大家放心吧!瑞佑(RAIO)已经将常用的型号都建库了,您不需要担心直接拿来用再慢慢细调,若有问题也可以向原厂询求技术支持,难度很小!

液晶屏参数定义举例:AT070TN92
	#ifdef AT070TN92

		//**[10h]**//
			Select_LCD_Sync_Mode();	// Enable XVSYNC, XHSYNC, XDE.
		//	Select_LCD_DE_Mode();	// XVSYNC & XHSYNC in idle state.
		
		PCLK_Falling();
		//PCLK_Rising();

		VSCAN_T_to_B();
		PDATA_Set_RGB();

		HSYNC_Low_Active();
		VSYNC_Low_Active();
		DE_High_Active();
		//DE_Low_Active();

		LCD_HorizontalWidth_VerticalHeight(800,480);//INNOLUX 800x480?

		/*	[16h][17h] : Figure 19-3 [HND]	Non Display or Back porch (pixels)		= (HNDR + 1) * 8 + HNDFTR  
			[18h] :		 Figure 19-3 [HST]	Start Position or Front porch (pixels)	= (HSTR + 1)x8
			[19h] :		 Figure 19-3 [HPW]	Pulse Width(pixels)						= (HPW + 1)x8
		*/
			LCD_Horizontal_Non_Display(38);//INNOLUX800x600,46?
			LCD_HSYNC_Start_Position(210);//INNOLUX800x600,16~354?
			LCD_HSYNC_Pulse_Width(8);//INNOLUX800x600,1~40C
				
		/*	[1Ch][1Dh] : Figure 19-3 [VND]	Non-Display Period(Line)	= (VNDR + 1)
			[1Eh] :		 Figure 19-3 [VST]	Start Position(Line)		= (VSTR + 1)
			[1Fh] :		 Figure 19-3 [VPW]	Pulse Width(Line)			= (VPWR + 1)
		*/
			LCD_Vertical_Non_Display(13);//INNOLUX800x600,23?
			LCD_VSYNC_Start_Position(22);//INNOLUX800x600,1~147?
			LCD_VSYNC_Pulse_Width(10);//INNOLUX800x600,1~20C

	#endif
到这里,基本就将软件设计说明完了,除此而外,瑞佑(RAIO)还新增加了一个上位机辅助界面设计工具,研发在做UI时,可以借助这个工具来开发,可以做到所见即所得的效果,开发效率极高,这些就留到下一节再做介绍吧!

基于单片机的图形控制芯片——瑞佑(RAIO)RA8889系列介绍(四)——软件篇_第1张图片
以上RA8889核心代码已打包,请关注公众号tftcontroller,回复“8889c”获取下载连接。
QQ讨论:598076690
http://www.lcdvision.com.cn

喜欢就请点赞、留言、关注

你可能感兴趣的:(RA8889)