Esempio n. 1
0
void PutPixel(int x,int y,int colour)
{
LCD_SetArea(x,y,x+1,y+1);
LCD_CtrlWrite_IC(0x2C);
LCD_DataWrite_IC(colour >> 8);
LCD_DataWrite_IC(colour & 0xFF);
}
Esempio n. 2
0
void FillRect(u8 x0, u8 y0, u8 x1, u8 y1, u16 color) {
	unsigned int wh, tmp;

	if(x0 > x1) {
		tmp = x0;
		x0  = x1;
		x1  = tmp;
	}
  
	if(y0 > y1) {
		tmp = y0;
		y0  = y1;
		y1  = tmp;
	}

	if((x1 >= LCD_WIDTH) ||
		(y1 >= LCD_HEIGHT)) {
		return;
	}

	LCD_SetArea(x0, y0, x1, y1);

	LCD_SendCMD(RAMWR);
	for(wh=((1+(x1-x0))*(1+(y1-y0))); wh!=0; wh--) {
		LCD_SendDAT16(color);
	}

}
Esempio n. 3
0
/*
*	Draw a Char
*/
u8 DrawChar5x7(u8 x, u8 y, char character, u16 color, u16 bgcolor) {
	u16 fontHeight, i, j, fontWidth, fontPos = 0;	
		
	if ( character < 32 ) return;
	if ( character > 127 ) return;
	
	fontWidth = 5;
	fontHeight = 7;
	
	fontPos = ( character - 32 ) * fontWidth;
	
	LCD_SetArea(x, y, x + fontWidth + 1, y+fontHeight);
    LCD_SendCMD(RAMWR);
	for (i = 0; i < fontWidth; i++) {
		for (j = 0; j <= fontHeight; j++) {      
			if ( ValBit( Font5x7[ fontPos + i ], j ) ) {				
				LCD_SendDAT16(color);
			} else {
				LCD_SendDAT16(bgcolor);
			}
		}	   
	}
	for (j = 0; j <= fontHeight; j++) { 
		LCD_SendDAT16(bgcolor);
	}
	fontWidth++;
	return x + fontWidth;
}
Esempio n. 4
0
/*
*	Draw a Char
*/
u8 DrawChar5x5(u8 x, u8 y, char character, u16 color, u16 bgcolor) {
	u16 fontIndex, i, j, fontWidth, fontPos = 0;	
	
	fontIndex = character-32;
	if ( character < 32 ) return;
	if ( fontIndex > 96 ) return;
	
	if ( fontIndex > 0 ) {
		fontPos = Font5x5WidthPos[ fontIndex - 1];
	}
	fontWidth = Font5x5WidthPos[ fontIndex ] - fontPos;
	
	LCD_SetArea(x, y, x+fontWidth+1, y+5);
    LCD_SendCMD(RAMWR);
	for (i = 0; i < fontWidth; i++) {
		for (j = 0; j <= 5; j++) {      
			if ( ValBit( Font5x5[ fontPos + i ], j ) ) {				
				LCD_SendDAT16(color);
			} else {
				LCD_SendDAT16(bgcolor);
			}
		}	   
	}
	for (j = 0; j <= 5; j++) { 
		LCD_SendDAT16(bgcolor);
	}
	fontWidth++;
	return x + fontWidth;
}
Esempio n. 5
0
void Fill(u16 color) {
	u16 i;
	
	LCD_SetArea(0, 0, LCD_WIDTH-1, LCD_HEIGHT-1);
	
	LCD_SendCMD(RAMWR);
	
	// start data transmission  
	for (i=0; i<LCD_WIDTH*LCD_HEIGHT; i++) {
		LCD_SendDAT16(color);
	}
	
}
Esempio n. 6
0
/*********************************************************************
* Function: void PutPixel(SHORT x, SHORT y)
*
* PreCondition: none
*
* Input: x,y - pixel coordinates
*
* Output: none
*
* Side Effects: none
*
* Overview: puts pixel
*
* Note: 
********************************************************************/
void LCD_PutPixel(u16 x, u16 y, u16 color)
{
	if(_clipRgn){
		if(x<_clipLeft)
			return;
		if(x>_clipRight)
			return;
		if(y<_clipTop)
			return;
		if(y>_clipBottom)
			return;
	}
  	
	LCD_SetArea(x,y,GetMaxX(),GetMaxY());
	LCD_WriteCommand(CMD_WR_MEMSTART);
	Clr_Cs;
	LCD_WriteData(color);
	Set_Cs;
}
Esempio n. 7
0
/*********************************************************************
* Function: void ClearDevice(void)
*
* PreCondition: none
*
* Input: none
*
* Output: none
*
* Side Effects: none
*
* Overview: clears screen with current color
*
* Note: none
*
********************************************************************/
void LCD_Clear(u16 color)
{
    u32 xcounter, ycounter;

    LCD_SetArea(0,0,GetMaxX(),GetMaxY());

    LCD_WriteCommand(CMD_WR_MEMSTART);

    Clr_Cs;
    for(ycounter=0; ycounter<GetMaxY()+1; ycounter++)
    {
        for(xcounter=0; xcounter<GetMaxX()+1; xcounter++)
        {
            LCD_WriteData(color);
        }
    }

    Set_Cs;
}
Esempio n. 8
0
void DrawIcon(u8 x, u8 y, u8 icon[]) {
	u8 i,ii;
	u16 color1 = WHITE, color2 = BLACK;
	
	LCD_SetArea(x, y, x + 10, y + 10);
	
	LCD_SendCMD(RAMWR);
	
	// start data transmission  
	for (i = 0; i < 10; i++) {
		for (ii = 0; ii <= 10; ii++) {
			if ( icon[(ii*10) + i] == 1 ) {
				LCD_SendDAT16(color1);
			} else {
				LCD_SendDAT16(color2);
			}			
		}
	}

}
Esempio n. 9
0
void FillM() {
	u16 i,ii;
	u16 color1 = RGB(255,255,255), color2 = RGB(100,100,100);
	u8 b = 0;
	LCD_SetArea(0, 0, LCD_WIDTH-1, LCD_HEIGHT-1);
	
	LCD_SendCMD(RAMWR);
	
	// start data transmission  
	for (i = 0; i < LCD_WIDTH; i++) {
		for (ii = 0; ii < LCD_HEIGHT / 2; ii++) {
			if ( b == 0 ) {
				LCD_SendDAT16(color1);
				LCD_SendDAT16(color2);								
			} else {
				LCD_SendDAT16(color2);
				LCD_SendDAT16(color1);				
			}
		}
		if ( b == 0 ) b = 1;
		else b = 0;
	}

}
Esempio n. 10
0
void LCD_WriteChar5x7(uint16_t x, uint16_t y, char c, uint16_t t_color,
    uint16_t b_color, uint8_t rot, uint8_t zoom) {
  unsigned char h, ch, p, mask, z, z1;

  if (rot != 0)
    LCD_SetArea(x, y, x + (6 * zoom) - 1, y + (8 * zoom) - 1);
  else
    LCD_SetArea(y, x, y + (8 * zoom) - 1, x + (6 * zoom) - 1);

  for (h = 0; h < 6; h++) {
    if (h < 5) {
      if ((uint8_t)c < 129)
        ch = font_5x7[c - 32][h];
      else
        ch = font_5x7[c - 32 - 63][h];

      if (rot != 0) {
        FSMC_LCD_Write_Register(0x0011,0x6078);
        FSMC_LCD_Write_Command(0x22);
      }
    } else
      ch = 0;

    z1 = zoom;
    while (z1 != 0) {
      if (rot != 0)
        mask = 0x01;
      else
        mask = 0x80;

      for (p = 0; p < 8; p++) {
        z = zoom;
				
				if(b_color == glass)
        while (z != 0) {
          if (ch & mask)
            FSMC_LCD_Write_Data(t_color);
          else
            FSMC_LCD_Read_Data();
          z--;
        }
				else
					while (z != 0) {
          if (ch & mask)
            FSMC_LCD_Write_Data(t_color);
          else
						FSMC_LCD_Write_Data(b_color);
          z--;
        }
				
        if (rot != 0)
          mask = mask << 1;
        else
          mask = mask >> 1;
      }
      z1--;
    }
  }
	
	LCD_SetArea(0,0,239,316);
}