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

📄 showcode.c

📁 usb demo codeusb demo code
💻 C
字号:
#include "config.h"

/* 显示U盘的第一个扇区的数据内容,
字符间距为2pixel,行间距为2pixel,字符宽度为5pixel,高度为7pixel */
 void ShowCode(uint8 *Dbuf)
{
	volatile uint8 x,y;
	int16 i=0;
	uint8 Pro_Buf[2]={0,0};
	for (y=20;y<=300;y+=9)
	{
		for (x=0;x<=220;x+=12)
		{
			
			if (Con_To_ASIC(Dbuf+i,Pro_Buf))
			{
				GUI_PutChar(x,y,Pro_Buf[0]);
				GUI_PutChar(x+5,y,Pro_Buf[1]);
				//GUI_PutChar(x+10,y,32);
				i++;
				if (i==512)
				return;
			}
			else 
			
			return ;
		}
	
	}
	
	return;
}
/* 根据参数显示ERROR1和ERROR2 */
void ShowError(uint8 Type)
{
	GUI_PutChar8_8(100,100,69);
	GUI_PutChar8_8(110,100,82);
	GUI_PutChar8_8(120,100,82);
	GUI_PutChar8_8(130,100,79);
	GUI_PutChar8_8(140,100,82);
	switch (Type)
	{
		case 1:
			GUI_PutChar8_8(150,100,49);
			break;
		case 2:
			GUI_PutChar8_8(150,100,50);
			break;
		default:
			break;
	}
}
/*  显示字符OK*/
 extern void ShowPer()
{
	GUI_PutChar8_8(100,150,79);
	GUI_PutChar8_8(110,150,75);
}
/* 满屏显示文本,字体高度为7pixel,宽度为5pixel,行间距为2pixel,字符间距为2pixel */
 uint16 ShowText(uint8 *buf)
{
	volatile uint16 x,y;
	int16 i=0;
	uint16 length;
	//length=length;
	if (buf==NULL)
		return 0;
	for (y=20;y<=300;y+=9)
	{
		for (x=0;x<=220;x+=7)
		{
			//if (mark)
			//{
				//GUI_PutChar(x,y,32);
				//i++;
				//continue;
			//}	
			if (*(buf+i)==0x0d)
			{
				i+=2;
				while (x<220)
					{
						GUI_PutChar(x,y,32);
						x+=7;
					}
				break;
			}
			
			GUI_PutChar(x,y,*(buf+i));
			i++;

			
				
		}
	}
	length=i;
	return length;
}
// 显示图片
void Disp_pic(uint8 *buf)
{
	//static uint32 x,y;
	uint16 colorT;
	uint8 i;

	for (i=0;i<240;i++)
	{
		colorT=RGB888_To_RGB565(buf);
		Disp_Pix(colorT);
		buf+=3;
	}
	//colorT=RGB888_To_RGB565(buf);
}
void  Disp_Pix(uint16 ColorDat)
{  

         TftSendDat(ColorDat);
      	   return;
   }






⌨️ 快捷键说明

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