//****************剪切图片 //剪切第picnum幅的图片,放在x1,y1,x2,y2在屏幕显示的区域坐标,x,y为要剪切图片的左上角坐标 void CutPicture(unsigned char picnum,unsigned short x1,unsigned short y1,unsigned short x2,unsigned short y2,unsigned short x,unsigned short y) { unsigned long cutaddress, picnumtemp; Write_Dir(0X06,0X00);//FLASH频率设定 if(picnum<61) { Write_Dir(0X05,0X06);//FLASH设置 ac cs1,2c cs0 Write_Dir(0Xc7,0X01); picnumtemp=picnum; } if(picnum>60&picnum<121) { Write_Dir(0X05,0X86); //ac Write_Dir(0Xc7,0X00); picnumtemp=picnum-60; } Write_Dir(0XBF,0X02);//FLASH设置 Active_Window(x1,x2,y1,y2); MemoryWrite_Position(x1,y1);//内存写入位置 cutaddress=(picnumtemp-1)*262144+y*960+x*2; DMA_Start_address_setting(cutaddress); DMA_block_mode_size_setting(x2-x1+1,y2-y1+1,480); Write_Dir(0XBF,0X03);//FLASH设置 Chk_DMA_Busy(); }
//****************显示flash图片(VS32240M35一个FLASH可以存储107幅图片,可以增加一个FLASH,即214幅图片) void displaypicture(unsigned char picnum) { unsigned int picnumtemp; Write_Dir(0X06,0X00);//FLASH频率设定 if(picnum<61) { Write_Dir(0X05,0X07);//FLASH设置 ac cs1,2c cs0 Write_Dir(0Xc7,0X01); picnumtemp=picnum; } if(picnum>60&picnum<121) { Write_Dir(0X05,0X87); //ac Write_Dir(0Xc7,0X00); picnumtemp=picnum-60; } Write_Dir(0XBF,0X02);//FLASH设置 Active_Window(0,479,0,271); //Write_Dir(0x41,(1-g_u8LcdLayer)); MemoryWrite_Position(0,0);//内存写入位置 DMA_Start_address_setting(262144*(picnumtemp-1)); DMA_block_mode_size_setting(480,272,480); Write_Dir(0XBF,0X03);//FLASH设置 Chk_DMA_Busy(); }
void CutPictrue(uchar picnum,uint x1,uint y1,uint x2,uint y2,unsigned long x,unsigned long y) {unsigned long cutaddress;uchar picnumtemp; Write_Dir(0X06,0X00);//FLASH frequency setting Write_Dir(0X05,0Xac);//FLASH setting picnumtemp=picnum; Write_Dir(0XBF,0X02);//FLASH setting Active_Window(x1,x2,y1,y2); MemoryWrite_Position(x1,y1);//Memory write position cutaddress=(picnumtemp-1)*261120+y*960+x*2; DMA_Start_address_setting(cutaddress); DMA_block_mode_size_setting(x2-x1+1,y2-y1+1,480); Write_Dir(0XBF,0X03);//FLASH setting Chk_DMA_Busy(); }
/* Private functions ---------------------------------------------------------*/ void DisplayImageBlockMode(uint startAddress,uint startx , uint starty, uint width, uint height) { Active_Window(startx,startx+width-1,starty,starty+height-1); MemoryWrite_Position(startx,starty);//Memory write position SROM_CLK_DIV(0X00);//FLASH frequency setting Serial_ROM_select1(); Serial_ROM_Address_set_24bit(); Select_Serial_Waveform_mode0(); SERIAL_ROM_Read_Cycle_4bus(); SERIAL_ROM_DMA_mode(); SERIAL_ROM_Dual_mode1(); DMA_Start_address_setting(startAddress);//DMA Start address setting DMA_block_mode_size_setting(width,height,width); DMA_Block_mode();//FLASH setting DMA_Start_enable();//FLASH setting Chk_DMA_Busy(); }