예제 #1
0
/*
 * Write bitmap of size HeightxWidth to Xpos,Ypos with double sized output dimensions
 */
void LCD_WriteBMPx2(uint8_t Xpos, uint16_t Ypos, uint8_t Height, uint16_t Width, uint8_t *bitmap)
{
  	uint32_t x,y;

  	LCD_SetDisplayWindow(Xpos, Ypos, (2*Width)-1, (2*Height)-1);
  	LCD_WriteRAM_Prepare();

  	for(x = 0; x < Height; x++)
  	{
  		for(y = 0; y < Width; y++)
  		{
  			uint16_t c = ((uint16_t *)bitmap)[(x*Width)+y];
  			Write_Dat(c);
  			Write_Dat(c);
  		}
  		for(y = 0; y < Width; y++)
  		{
  			uint16_t c = ((uint16_t *)bitmap)[(x*Width)+y];
  			Write_Dat(c);
  			Write_Dat(c);
  		}
  	}
	//�ָ������С
	LCD_WriteReg(R80, 0x0000); //ˮƽ����GRAM��ʼ��ַ
	LCD_WriteReg(R81, 0x00EF); //ˮƽ����GRAM�����ַ
	LCD_WriteReg(R82, 0x0000); //��ֱ����GRAM��ʼ��ַ
	LCD_WriteReg(R83, 0x013F); //��ֱ����GRAM�����ַ
}
예제 #2
0
void LCD_ShowChar(uint8_t x,uint16_t y,uint8_t chars,uint8_t size,uint8_t mode)
{
	uint8_t temp;
    uint8_t pos,t;
    if(x>MAX_CHAR_POSX||y>MAX_CHAR_POSY) return;

	LCD_SetDisplayWindow(x,y,(size/2-1),size-1);  //����

	LCD_WriteRAM_Prepare();        //��ʼд��GRAM
	if(!mode) 						//�ǵ��ӷ�ʽ
	{
		for(pos=0;pos<size;pos++)
		{
			if(size==12)temp=ASCII_1206[chars-0x20][pos];//����1206����
			else temp=ASCII_1608[chars-0x20][pos];		 //����1608����
			for(t=0;t<size/2;t++)
		    {
		        //if(temp&0x01)            	 			//�ȴ���λ��ȡģ�й�ϵ
		        if((temp<<t)&0x80)						//�ȴ���λ
				{
					Write_Dat(RED);
				}
				else
				{
					Write_Dat(WHITE);
		        }
				//temp>>=1; 	   							//����ȴ���λ��ȥ��������
		    }
		}
	}
	else//���ӷ�ʽ
	{
		for(pos=0;pos<size;pos++)
		{
			if(size==12)temp=ASCII_1206[chars-0x20][pos];	//����1206����
			else temp=ASCII_1608[chars-0x20][pos];		 	//����1608����
			for(t=0;t<size/2;t++)
		    {
		        if((temp<<t)&0x80)LCD_DrawPoint(x+t,y+pos);	//��һ����
		        //temp>>=1; 								//����ȴ���λ��ȥ��������
		    }
		}
	}
	/* �ָ������С	*/
	LCD_WriteReg(R80, 0x0000); //ˮƽ����GRAM��ʼ��ַ
	LCD_WriteReg(R81, 0x00EF); //ˮƽ����GRAM�����ַ
	LCD_WriteReg(R82, 0x0000); //��ֱ����GRAM��ʼ��ַ
	LCD_WriteReg(R83, 0x013F); //��ֱ����GRAM�����ַ
}
예제 #3
0
      static void clear( color c = white ){
         int d = from_color( c );
	      LCD_SetCursor( 0x00, 0x0000 );      
   	   Write_Cmd( 0x22 ); // write RAM prepare             
	      for( int index = 0; index < 76800; index++ ){
		      Write_Dat( d );    
   	   } 
      }
예제 #4
0
/*****************************************************************************
** �������: LCD_Clear
** ��������: ����Ļ����
** ��  ����: Dream
** �ա�  ��: 2010��12��06��
*****************************************************************************/
void LCD_Clear(uint16_t Color)
{
	uint32_t index=0;      
	LCD_SetCursor(0x00,0x0000); //���ù��λ�� 
	LCD_WriteRAM_Prepare();     //��ʼд��GRAM	 	  
	for(index=0;index<76800;index++)
	{
		Write_Dat(Color);    
	}
}
예제 #5
0
/*****************************************************************************
** �������: WriteOneASCII
** ��������: ��ʾһ��ָ����С���ַ�
** ��  ����: Dream
** �ա�  ��: 2010��12��06��
*****************************************************************************/
uint16_t WriteOneASCII(uint8_t *pucMsk,
                              uint16_t x0,
                              uint16_t y0,
                              uint16_t color,
                              uint8_t transparent)
{
    uint16_t i,j;
    uint16_t y;
    uint8_t ucChar;
    
    y = y0;
    for(i=0; i<16; i++) {                                 /* 16��                         */
        ucChar = *pucMsk++;
        #ifdef __DISPLAY_BUFFER                           /* ʹ���Դ���ʾ                 */
        for(j=0; j<8; j++) {                              /* 8��                          */
            if((ucChar << j)& 0x80) {                     /* ��ʾ��ģ                     */
                DispBuf[240*(y0+i) + x0+j] = color;
            }
        }
        #else                                             /* ֱ����ʾ                     */
        
        LCD_SetCursor(x0, y);                             /* ����д��ݵ�ַָ��           */
		LCD_WriteRAM_Prepare();        					  /* ��ʼд��GRAM	    		  */
        for(j=0; j<8; j++) {                              /* 8��                          */
            if((ucChar << j) & 0x80) {                    /* ��ʾ��ģ                     */
                Write_Dat(color);
            } else {
            	if (transparent==0)
            		Write_Dat(BACK_COLOR);
            	else
            	{
            		/* skip this one */
                    LCD_SetCursor(x0+j+1, y);
            		LCD_WriteRAM_Prepare();
            	}
            }
        }
        y++;
        #endif
    }
    return (8);                                           /* ����16λ�п�                 */
}
예제 #6
0
/*****************************************************************************
** �������: LCD_Fill
** ��������: ��ָ�����������ָ����ɫ
				�����С:  (xend-xsta)*(yend-ysta) 
** ��  ����: Dream
** �ա�  ��: 2010��12��06��
*****************************************************************************/
void LCD_Fill(uint8_t xsta,uint16_t ysta,uint8_t xend,uint16_t yend,uint16_t color)
{                    
    uint32_t n;
	//����										
	LCD_WriteReg(R80, xsta); //ˮƽ����GRAM��ʼ��ַ
	LCD_WriteReg(R81, xend); //ˮƽ����GRAM�����ַ
	LCD_WriteReg(R82, ysta); //��ֱ����GRAM��ʼ��ַ
	LCD_WriteReg(R83, yend); //��ֱ����GRAM�����ַ	
	LCD_SetCursor(xsta,ysta);//���ù��λ��  
	LCD_WriteRAM_Prepare();  //��ʼд��GRAM	 	   	   
	n=(u32)(yend-ysta+1)*(xend-xsta+1);    
	while(n--){Write_Dat(color);}//��ʾ��������ɫ. 
	//�ָ�����
	LCD_WriteReg(R80, 0x0000); //ˮƽ����GRAM��ʼ��ַ
	LCD_WriteReg(R81, 0x00EF); //ˮƽ����GRAM�����ַ
	LCD_WriteReg(R82, 0x0000); //��ֱ����GRAM��ʼ��ַ
	LCD_WriteReg(R83, 0x013F); //��ֱ����GRAM�����ַ	    
}
예제 #7
0
/*****************************************************************************
** �������: LCD_WriteBMP
** ��������: ��ָ����λ����ʾһ��ͼƬ
				Xpos��YposΪͼƬ��ʾ��ַ��Height��Width ΪͼƬ�Ŀ�Ⱥ͸߶�
** ��  ����: Dream
** �ա�  ��: 2010��12��06��
*****************************************************************************/
void LCD_WriteBMP(uint8_t Xpos, uint16_t Ypos, uint8_t Height, uint16_t Width, uint8_t *bitmap)
{
  	uint32_t index;
  	uint32_t size = Height * Width;
  	uint16_t *bitmap_ptr = (uint16_t *)bitmap;

  	LCD_SetDisplayWindow(Xpos, Ypos, Width-1, Height-1);

  	//LCD_WriteReg(0x03, 0x1038);	//�����Ҫ������ʾͼƬ������ȥ������ ��ͬʱ��Width��Hight����һ�¾Ϳ���

  	LCD_WriteRAM_Prepare();

  	for(index = 0; index < size; index++)
  	{
    	Write_Dat(*bitmap_ptr++);
  	}
	//�ָ������С	 
	LCD_WriteReg(R80, 0x0000); //ˮƽ����GRAM��ʼ��ַ
	LCD_WriteReg(R81, 0x00EF); //ˮƽ����GRAM�����ַ
	LCD_WriteReg(R82, 0x0000); //��ֱ����GRAM��ʼ��ַ
	LCD_WriteReg(R83, 0x013F); //��ֱ����GRAM�����ַ
}
예제 #8
0
      static void pixel_write( vector p, color c ){
	      LCD_SetCursor( p.x_get(), p.y_get() );                                              
	      Write_Cmd( 0x22 ); // write RAM prepare                                          
	      Write_Dat( from_color( c )); 	         
      }
예제 #9
0
static void LCD_WriteReg( int reg, int data ){
	Write_Cmd( reg );
	Write_Dat( data );
}
예제 #10
0
/*****************************************************************************
** �������: LCD_Write_Reg
** ��������: дָ����
** ��  ����: Dream
** �ա�  ��: 2010��12��06��
*****************************************************************************/
void LCD_WriteReg(uint16_t LCD_Reg,uint16_t LCD_Dat)
{
	Write_Cmd(LCD_Reg);
	Write_Dat(LCD_Dat);
}
예제 #11
0
/*****************************************************************************
** �������: LCD_DrawPoint
** ��������: дһ����
** ��  ����: Dream
** �ա�  ��: 2010��12��06��
*****************************************************************************/
void LCD_DrawPoint(uint16_t x,uint16_t y)
{
	LCD_SetCursor(x,y);//���ù��λ�� 
	Write_Cmd(R34);//��ʼд��GRAM
	Write_Dat(POINT_COLOR); 	
}