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

📄 kb.c

📁 自己编写的
💻 C
📖 第 1 页 / 共 2 页
字号:

	rLCDCON1=(1)|(1<<5)|(0<<7)|(0x3<<8)|(0x3<<10)|(CLKVAL_MONO<<12);
	    // enable,4B_SNGL_SCAN,WDLY=8clk,WLH=8clk,
    
}
void displaylcd32(char x, char y, char num)
{
    unsigned int *pbuffer,temp_data;
    unsigned int i=0, j=0, m=0;
    //clrscreen();
    pbuffer =(U32*) frameBuffer1;
    for(m=0; m<HIGHB; m++)
     {
       i = (y+m)*XTOTAL/EVERYX+x/EVERYX;
	//Uart_Printf("the i is : %x   \n", i);
       temp_data = (Bitmap32[num][m*4] << 24) + (Bitmap32[num][m*4+1] << 16) + (Bitmap32[num][m*4+2] << 8) +(Bitmap32[num][m*4+3]);
       j=(pbuffer[i]>>(EVERYX- x%EVERYX))<<(EVERYX-x%EVERYX);
	pbuffer[i]=j|(temp_data>>(x%EVERYX));
	//Uart_Printf("pbuffer[%d]= %x   \n", i, pbuffer[i]);   
	j=(pbuffer[i+1]<<(x%EVERYX))>>(x%EVERYX);
	pbuffer[i+1] = j|(temp_data<<(EVERYX-x%EVERYX));       // ~temp_data;  
       // Uart_Printf("pbuffer[%d]= %x   \n", i+1, pbuffer[i+1]);  
      }
}

void clear(void)
{ 
     unsigned int *pbuffer;
     int i;
     

    pbuffer =(U32*) frameBuffer1;
    for(i = 0; i< (9600/4) ;i++)
    {
        pbuffer[i] = 0;
 }

}

void kb_displaylcd(unsigned short int type)
{
   unsigned int *pbuffer,temp_data;
     int i;
    pbuffer =(U32*) frameBuffer16;
    clrscreen();
  if (type==1)
  {  
    for(i = 0; i< (38400/4) ;i++)
         {
            temp_data = (plmmBitmap1[i*4] << 24) + (plmmBitmap1[i*4+1] << 16) + (plmmBitmap1[i*4+2] << 8) +(plmmBitmap1[i*4+3]);
            pbuffer[i] = temp_data;
          }
   }
  if (type==2) 
  {  
    for(i = 0; i< (38400/4) ;i++)
         {
            temp_data = (plmmBitmap2[i*4] << 24) + (plmmBitmap2[i*4+1] << 16) + (plmmBitmap2[i*4+2] << 8) +(plmmBitmap2[i*4+3]);
            pbuffer[i] = temp_data;
          }
   }
  if (type==3)
  {  
    for(i = 0; i< (38400/4) ;i++)
         {
            temp_data = (plmmBitmap3[i*4] << 24) + (plmmBitmap3[i*4+1] << 16) + (plmmBitmap3[i*4+2] << 8) +(plmmBitmap3[i*4+3]);
            pbuffer[i] = temp_data;
          }
   }
  if (type==4)
  {  
    for(i = 0; i< (38400/4) ;i++)
         {
            temp_data = (plmmBitmap4[i*4] << 24) + (plmmBitmap4[i*4+1] << 16) + (plmmBitmap4[i*4+2] << 8) +(plmmBitmap4[i*4+3]);
            pbuffer[i] = temp_data;
          }
   }
}


/*___________________________added by liangwd 05-5-23___________________________*/


void display_hello(void)
{

     unsigned int *pbuffer,temp_data;
     int j = 0, i = 0, h=0;
    pbuffer =(U32*) frameBuffer16;
    clrscreen();
	 for(h = 0 , j = 1; j< 40 ; j++)
	 {
         for(i = 0; i< (1920/4) ;i++)
            {
              h ++;
              temp_data = (plmmhello[i*4] << 24) + (plmmhello[i*4+1] << 16) + (plmmhello[i*4+2] << 8) +(plmmhello[i*4+3]);
		pbuffer[h] = temp_data;
             }
	 }
}


/*
void display_pic(void)
{
   unsigned int *pbuffer,temp_data;
     int i = 0;
    pbuffer =(U32*) frameBuffer16;
    clrscreen();
	
    for(i = 0; i< (9600/4) ;i++)
         {
            temp_data = (smlogo[i*4] << 24) + (smlogo[i*4+1] << 16) + (smlogo[i*4+2] << 8) +(smlogo[i*4+3]);
            pbuffer[i] = temp_data;
          }
}
*/

void display_pic(void)

{
   unsigned int *pbuffer,temp_data;
     int i = 0;
    pbuffer =(U32*) frameBuffer16;
    clrscreen();
	
    for(i = 0; i< (9600) ;i++)
         {
            temp_data = (smlogo[i*4] << 24) + (smlogo[i*4+1] << 16) + (smlogo[i*4+2] << 8) +(smlogo[i*4+3]);
	     pbuffer[i] = temp_data;
		//pbuffer[i] = text_translate(smlogo[i]);   //temp_data;

          }
}


void display_test(void)
{

   unsigned int *pbuffer;
     int i = 0;
    pbuffer =(U32*) frameBuffer16;
    clrscreen();
	
    for(i = 0; i< (38400/4) ;i++)
         {
            pbuffer[i] = 0xff;
          }
}

/*
*translate text code into 16 level gray data.
*/
unsigned int text_translate(unsigned char data_text)
{
	unsigned int temp =0;
	unsigned int k = 0;
	for(k = 8 ; k > 0 ; k --)
		{
		temp <<= 4;
		temp +=((data_text >>(k - 1))& 0x01) * 0x0f;
		}
	return temp;
}

/*
*display a 16X16 text code at the right position.
*/
void Displaytext(int position, unsigned char *n  )
{
   unsigned int *pbuffer;
    int i = 0;
    pbuffer =(U32*) frameBuffer16;
	Cleartext(position);
	for(i = 0; i < 32/2; i ++)
	{
            		pbuffer[position] = text_translate(n[i*2]);
            		pbuffer[position + 1] = text_translate(n[ i*2+1]);
			position = position + 30;
	}
}

/*
*clear a 16X16 block at the right position.
*/
void Cleartext(int position)
{
   unsigned int *pbuffer;
    int i = 0;
     pbuffer =(U32*) frameBuffer16;

	for(i = 0; i < 32/2; i ++)
	{
            		pbuffer[position] = 0x00;
            		pbuffer[position + 1] = 0x00;
			position = position + 30;
	}
}

/*
*black a 16X16 block at the right position.
*/
void Blacktext(int position)
{
   unsigned int *pbuffer;
    int i = 0;
     pbuffer =(U32*) frameBuffer16;
	for(i = 0; i < 32/2; i ++)
	{
            		pbuffer[position] = 0xffffffff;
            		pbuffer[position + 1] = 0xffffffff;
			position = position + 30;
	}
}

/*
*negate a 16X16 block at the right position.
*/
void Selecttext(int position)

{
   unsigned int *pbuffer;
    int i = 0 , temp = 0;
     pbuffer =(U32*) frameBuffer16;
	for(i = 0; i < 32/2; i ++)
	{
            		temp = pbuffer[position];
			pbuffer[position] = ~temp;
            		temp = pbuffer[position + 1];
			pbuffer[position + 1] = ~temp;
			position = position + 30;
	}
}

/*
*display a 8X8 character at the right position.
*/
void Displaycharacter(unsigned int position,  char *n  )
{
   unsigned int *pbuffer;
   unsigned int i = 0;

   pbuffer = (U32*) frameBuffer16;
	for(i = 0; i < 8; i ++)
	{
            		pbuffer[position] = text_translate(*n++);
			position = position + 30;

	}
}

/*
* 显示一串字符
*/
//void Display_character(unsigned char column, unsigned char line,  char *p)
//{
//	unsigned int position = 0;
//	char c;
//	do{
//		position = column + line*LCD_XSIZE;
//		c = *p++;
//		if ((c >= 65)&&(c <= 90))
//			Displaycharacter(position, capital_letter[(c - 65)]);
//		else
//			{
//		switch(c)
//			{
//			case 32:
//				Displaycharacter(position, capital_letter[26]);
//				break;
//			case 37:
//				Displaycharacter(position, capital_letter[27]);
//				break;
//			case 43:
//				Displaycharacter(position, capital_letter[28]);
//				break;
//			case 45:
//				Displaycharacter(position, capital_letter[29]);
//				break;
//			case 46:
//				Displaycharacter(position, capital_letter[30]);
//				break;
//			case 47: 
//				Displaycharacter(position, capital_letter[31]);
//				break;
//			case 61:
//				Displaycharacter(position, capital_letter[32]);
//				break;
//			case 109:
//				Displaycharacter(position, capital_letter[33]);
//				break;
//			default:
//				break;	
//			}
//			}
//		column++;
//		 if (column > 29 )
//			{
//			column = column - 30;
//			line ++;
//			}
//		}while(*p != 0x0);
//}


//void Display_number(unsigned char column, unsigned char line,  unsigned int number)
//{
//	unsigned int position = 0 ;
//	unsigned char no1 = 0;
//	do{
//		position = column + line*LCD_XSIZE;
//		no1 = number % 10;
//		number = number / 10;
//		if (no1 <= 9)
//			Displaycharacter(position, charactor_number[no1]);
//		column --;
//		}while(number != 0);
//}

/*
*clear a 8X16 block at the right position.
*/
void Clearcharacter(int position)
{
   unsigned int *pbuffer;
    int i = 0;
     pbuffer =(U32*) frameBuffer16;

	for(i = 0; i < 16; i ++)
	{
            		pbuffer[position] = 0x00;

			position = position + 30;
	}
}

/*
*black a 8X16 block at the right position.
*/
void Blackcharacter(int position)
{
   unsigned int *pbuffer;
    int i = 0;
     pbuffer =(U32*) frameBuffer16;
	for(i = 0; i < 16; i ++)
	{
            		pbuffer[position] = 0xffffffff;
			position = position + 30;
	}
}


//negate a 8X16 block at the right position.
void Selectcharacter(int position)
{
   unsigned int *pbuffer;
    int i = 0 , temp = 0;
     pbuffer =(U32*) frameBuffer16;
	for(i = 0; i < 16; i ++)
	{
            		temp = pbuffer[position];
			pbuffer[position] = ~temp;
			position = position + 30;
	}
}


//draw a horizontal line
//240x640
void DrawHorizontalLine(int position, unsigned  int linelong)
{
unsigned int *pbuffer;
unsigned int i , j , temp = 0, para= 0xf0000000;
pbuffer = (U32*)frameBuffer256;
for(i = 0; i < linelong/8; i ++)
	{
	pbuffer[position] = 0xffffffff;
	position ++;
	Delay(1500);
	}

for(j = 0; j < ( linelong % 8); j ++)
	{
	temp = temp | para;
	para = para >> 4;
	}
	Delay(1500);
	pbuffer[position] = temp;
}


//draw a  perpendicular line
//120X320

void DrawPerpendicularLine(int position, unsigned int linelong)
{
unsigned char *pbuffer;
int i = 0;
pbuffer = (U8*)frameBuffer256;
for(i = 0; i < linelong; i ++)
	{
	pbuffer[position] = 0xff;
	position = position + 320;
	}
}

/*
*save a control file
*/

void Savefile(unsigned char file_number, unsigned int point)
{


}

/*
*open a control file

*/
void Openfile(unsigned char file_number)

{

}

/*___________________________end___	________________________*/



⌨️ 快捷键说明

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