Esempio n. 1
0
/*************************************************************
*	函数名称:PutGB1616
*	功    能:在指定位置显示单个汉字
*	参    数:
*				x:  窗体中X坐标中较小者
*	 		 	y:  窗体中Y坐标中较小者
*				C[]:待显示的汉字
*				fColor:字体颜色
*				bColor:背景颜色 
*	返 回 值:无
*************************************************************/
void LCD_PutGB1616(u16 x, u16  y, u8 c[2], u16 fColor,u16 bColor)
{
	unsigned int i,j,k;
	char_or_word=1;		//设置为显示汉字,为0则为显示字符
	LCD_SetPos(x,y);

	for(k=0;k<67;k++) 
	{ //64标示自建汉字库中的个数,循环查询内码
	    if ((codeGB_16[k].Index[0]==c[0])&&(codeGB_16[k].Index[1]==c[1]))	 //找到对应的汉字
	    {
            for(i=0;i<32;i++) 
    		{											
    		 	unsigned short m=codeGB_16[k].Msk[i];
    		  	for(j=0;j<8;j++) 
    		  	{
    				if((m&0x80)==0x80) 
    					LCD_WR_DATA(fColor);		 //开始写入汉字颜色
    				else 
    					LCD_WR_DATA(bColor);		 //开始写入背景颜色
    				m<<=1;
    			} 
    		}
            break;
	    }
	}	
}
Esempio n. 2
0
void Put_mych(unsigned short x, unsigned short  y,unsigned int width, unsigned int height,  const char mycode[], unsigned int fColor)
{
	unsigned int i, j; //, //k;
	unsigned int k, l;
	k = width*height/8;
    l = width/8;
	//LCD_SetPos(x,  x+width-1,y, y+height-1);
	for(i = 0; i < k; i ++)
	{
		unsigned short m = mycode[i];
		for(j = 0; j < 8; j ++)
		{
			   if((m&0x80) == 0x80)
			   {
                   // LCD_SetPos(x+i%l*8+j, x+i%l*8+j, y+i/l, y+i/l);
			   	   LCD_SetPos(y+i/l, y+i/l, x+i%l*8+j, x+i%l*8+j);
                   Write_Data_U16(fColor);
			   }
//			   else
//			   {
//			   		//Write_Data_U16(bColor);
//			   }
			   m <<= 1;
		}
	}
}
Esempio n. 3
0
void CLR_Screen(unsigned int bColor)
{
 unsigned int i,j;
 LCD_SetPos(0,240,0,320);//320x240
 for (i=0;i<320;i++)
	{
	   for (j=0;j<240;j++)
	       Write_Data_U16(bColor);
	}
}
Esempio n. 4
0
void Show_RGB (unsigned int x0,unsigned int x1,unsigned int y0,unsigned int y1,unsigned int Color)
{
	unsigned int i,j;
	LCD_SetPos(x0,x1,y0,y1);      //设置显示位置
	for (i=y0;i<=y1;i++)
	{
	   for (j=x0;j<=x1;j++)
	       Write_Data_U16(Color);
	}
}
void draw_fft()
{
  uint16 i,j;
  for(i = 0; i<160;i++ )
  {
    if(FFT_RESULT_NEW[i] - FFT_RESULT_OLD[i]>0)
    {
      LCD_SetPos(i*2,i*2,FFT_RESULT_OLD[i],FFT_RESULT_NEW[i]);
      for (j=0;j <FFT_RESULT_NEW[i] - FFT_RESULT_OLD[i];j++)
        write_word(Blue + j*30);
    }
    else if(FFT_RESULT_NEW[i] - FFT_RESULT_OLD[i]<0)
    {
      LCD_SetPos(i*2,i*2,FFT_RESULT_NEW[i],FFT_RESULT_OLD[i]);
      for (j=0;j<FFT_RESULT_OLD[i] - FFT_RESULT_NEW[i];j++)
        write_word(Black);
    }
    FFT_RESULT_OLD[i] =  FFT_RESULT_NEW[i];
  }
  
}
Esempio n. 6
0
void Set_Color(uchar x, uint y, uchar length, uint high, uchar color)
{
	 uchar i, xi;
	 uint  j, xj;
	 xi =  x+length-1;
	 xj =  y+high-1;
	 LCD_SetPos(x, xi, y, xj);
	 for(i = x; i < xi; i ++)
	 {
	 	for(j = y; j < xj; j ++)
		{
			Write_Data_U16(color);
		}
	 }
}
Esempio n. 7
0
void GUI_DisPicture(uchar x, uint y, uchar length, uint high ,const uchar *pic)
//void GUI_DisPicture(uchar x, uint y, uchar length, uint high)
{
    unsigned int temp=0,tmp=0,num=0;
	LCD_SetPos(x, x+length-1, y, y+high-1);
	num=length*high*2;
	do
	{  
	   //temp=pic[tmp]|( pic[tmp+1]<<8);
	   temp=pic[tmp+1];
	   temp=temp<<8;
	   temp=temp|pic[tmp];
	   Write_Data_U16(temp);//逐点显示
	   tmp+=2;
	}while(tmp<num);
}
Esempio n. 8
0
void Put_mych(unsigned short x, unsigned short y, unsigned int width, unsigned int height, const char mycode[], unsigned int fColor)
{
    unsigned int i, j;
    unsigned int k, l;
    
    k = width*height/8;
    l = width/8;
    
    for(i = 0; i < k; i ++) {
        unsigned short m = mycode[i];
        for(j = 0; j < 8; j ++) {
            if((m&0x80) == 0x80) {
                LCD_SetPos(y+i/l, y+i/l, x+i%l*8+j, x+i%l*8+j);
                Write_Data_U16(fColor);
            }
            m <<= 1;
        }
    }
}
Esempio n. 9
0
/*************************************************************
*	函数名称:LCD_PutChar
*	功    能:在指定位置显示一个字符
*	参    数:
*				x:  窗体中X坐标中较小者
*	 		 	y:  窗体中Y坐标中较小者
*				c:待显示的字符
*				fColor:字体颜色
*				bColor:背景颜色 
*	返 回 值:无
*************************************************************/
void LCD_PutChar8x16(u16 x, u16 y, char c, u16 fColor, u16 bColor)
{
	unsigned int i,j;
	char_or_word=0;		//设置为显示为字符,1则为显示汉字	
	LCD_SetPos(x,y);
 	
	for(i=0; i<16;i++) 
	{
		unsigned char m=Font8x16[c*16+i];		  //直接找到字符
		for(j=0;j<8;j++) 
		{
			if((m&0x80)==0x80)
				LCD_WR_DATA(fColor);
			else
				LCD_WR_DATA(bColor);
			m<<=1;
		}
	}
}
Esempio n. 10
0
int main()
{
    CyGlobalIntEnable; /* Enable global interrupts. */
    
    I2CM_LCD_Start();
    // akizuki AQM1602(5V)
    //LCD_Init(0x3e, 12);
    // akizuki AQM1602(3.3V)
    LCD_Init(0x3e, 32);
    
    CyDelay(100);
    
    LCD_Puts("Hello PSoC 5LP");

    for(;;)
    {
        LCD_SetPos(0, 1);
        LCD_Puts("Prototyping Kit ");
    }
}
Esempio n. 11
0
void Put_mych(unsigned short x, unsigned short  y,unsigned int width, unsigned int height,  const char mycode[], unsigned int fColor,unsigned int bColor)
{
	unsigned int i, j; //, //k;
	unsigned int k;
	k = width*height/8;
	LCD_SetPos(y, y+height-1, x,  x+width-1);
	for(i = 0; i < k; i ++)
	{
		unsigned short m = mycode[i];
		for(j = 0; j < 8; j ++)
		{
			   if((m&0x80) == 0x80)
			   {
			   		Write_Data_U16(fColor);
			   }
			   else
			   {
			   		Write_Data_U16(bColor);
			   }
			   m <<= 1;
		}
	}
}
Esempio n. 12
0
void Put_pixel(unsigned int x, unsigned int y, unsigned int color)
{
	LCD_SetPos(x, x, y, y);
	Write_Data_U16(color);
}
Esempio n. 13
0
void main()
{  
    unsigned int x1, x2;
    unsigned int y1, y2;
    unsigned int color = White;
    
    TFT_Initial();
    CLR_Screen(Black); 
    
    for(x1 = 0; x1 < 40; x1 ++)
        for(y1 = 0; y1 < 40; y1 ++)
            Put_pixel(x1, y1, Blue);
    
    for(x1 = 0; x1 < 40; x1 ++)
        for(y1 = 40; y1 < 80; y1 ++)
            Put_pixel(x1, y1, White);
    
    for(x1 = 0; x1 < 40; x1 ++)
        for(y1 = 80; y1 < 120; y1 ++)
            Put_pixel(x1, y1, Red);
    
    for(x1 = 0; x1 < 40; x1 ++)
        for(y1 = 120; y1 < 160; y1 ++)
            Put_pixel(x1, y1, Magenta);
            
    for(x1 = 0; x1 < 40; x1 ++)
        for(y1 = 160; y1 < 200; y1 ++)
            Put_pixel(x1, y1, Green);
    
    for(x1 = 0; x1 < 40; x1 ++)
        for(y1 = 200; y1 < 240; y1 ++)
            Put_pixel(x1, y1, Cyan);
    
    for(x1 = 0; x1 < 40; x1 ++)
        for(y1 = 240; y1 < 280; y1 ++)
            Put_pixel(x1, y1, Yellow);
            
    for(y1 = 0; y1<320; y1 ++) {
        Put_pixel(42, y1, 0x0FF2);
        Put_pixel(43, y1, 0xD621);
    }
     
    while(1) {
        if(!Penirq) {
            x1 = get_X();
            x2 = get_X();
            
            y1 = get_Y();
            y2 = get_Y();
            
            if(abs(x1-x2)<2 && abs(y1-y2)<2) {
                x1 = (x1+x2)/2;
                y1 = (y1+y2)/2;
                
                y1 = 320 - y1;
                
                if(x1 < 41) {
                    if(y1<41)
                        color = Blue;
                    else if(y1<81)
                        color = White;
                    else if(y1<121)
                        color = Red;
                    else if(y1<161)
                        color = Magenta;
                    else if(y1<201)
                        color = Green;
                    else if(y1<241)
                        color = Cyan;
                    else if(y1<281)
                        color = Yellow;
                    else {
                        LCD_SetPos(44, 240, 0, 320); 
                        for (y1 = 0; y1 < 320; y1 ++) {
                            for (x1 = 44; x1 < 240; x1 ++)
                                Write_Data_U16(Black);
                        }
                    }  
                } else {
                    Put_pixel(x1, y1, color);
                }
            }
        }
    }
}
Esempio n. 14
0
//================================================================================================
//	实现功能:	画点
//  输入参数:  x,y 需要画点坐标
//              color 点的颜色
//================================================================================================
void Put_pixel(unsigned int y,unsigned int x,unsigned int color)
{
	LCD_SetPos(x,x,y,y);        //设置待画点坐标
	Write_Data_U16(color);      //在指定点写入颜色数据
}
Esempio n. 15
0
/*======================================================
 * メインルーチン 
 *
 *======================================================*/
int main()
{
    char LCD_LINE[17] = "";
    
    /* Init and start sequencing SAR ADC */
    ADC_SAR_Seq_Start();
    ADC_SAR_Seq_StartConvert();
    
    /* Init and start I2C master */
    I2CM_Start();
	CyDelay(500);
    
	CyGlobalIntEnable;
	
    /* Start I2C LCD */
    // LCDをRESET
	LCD_RESET_Write(0u);
	CyDelay(1);
	LCD_RESET_Write(1u);
	CyDelay(10);
	
	LCD_Init(32);
    
    LCD_Clear();
	LCD_Puts("Pyun2Controller2");
    LCD_SetPos(0, 1);
	LCD_Puts("Demonstration");
    CyDelay(500);

    for(;;)
    {
        pollingADC();        
        pollingSW();
        
#ifdef _ADC_8BIT
        sprintf(LCD_LINE, "%02x %02x %02x : %02x %02x",
            adcResult[ADC_CH_POT1_N] >> 3,
            adcResult[ADC_CH_POT2_N] >> 3,
            adcResult[ADC_CH_POT3_N] >> 3,
            adcResult[ADC_CH_JOY1_N] >> 3,
            adcResult[ADC_CH_JOY2_N] >> 3
        );
#else
        sprintf(LCD_LINE, "%03x%03x%03x:%03x%03x",
            adcResult[ADC_CH_POT1_N],
            adcResult[ADC_CH_POT2_N],
            adcResult[ADC_CH_POT3_N],
            adcResult[ADC_CH_JOY1_N],
            adcResult[ADC_CH_JOY2_N]
        );
#endif        

        LCD_SetPos(0, 0);
        LCD_Puts(LCD_LINE);
        
        sprintf(LCD_LINE, "%s %s %s %s : %s %s   ",
            buttonStatus.green ? "G" : "x",
            buttonStatus.yellow ? "Y" : "x",
            buttonStatus.red ? "R" : "x",
            buttonStatus.blue ? "B" : "x",
            buttonStatus.black ? "K" : "x",
            buttonStatus.white ? "W" : "x"
        );            
            
        LCD_SetPos(0, 1);
        LCD_Puts(LCD_LINE);        
        
        //CyDelay(1000);
    }
}