//在指定区域内填充指定颜色
//区域大小:
//  (xend-xsta)*(yend-ysta)
void LCD_Fill(u16 xsta,u16 ysta,u16 xend,u16 yend,u16 color)
{          
	u16 i,j;
	u16 xlen=0;
#if USE_HORIZONTAL==1
	xlen=yend-ysta+1;	   
	for(i=xsta;i<=xend;i++)
	{
	 	LCD_SetCursor(i,ysta);      //设置光标位置 
		LCD_WriteRAM_Prepare();     //开始写入GRAM	  
		for(j=0;j<xlen;j++)LCD_WR_DATA(color);//设置光标位置 	  
	}
#else
	xlen=xend-xsta+1;	   
	for(i=ysta;i<=yend;i++)
	{
	 	LCD_SetCursor(xsta,i);      //设置光标位置 
		LCD_WriteRAM_Prepare();     //开始写入GRAM	  
		for(j=0;j<xlen;j++)LCD_WR_DATA(color);//设置光标位置 	    
	}
#endif						  	    
}  
Пример #2
0
//------------------------------------------------------------------------------
/// Fills the given LCD buffer with a particular color.
/// Only works in 24-bits packed mode for now.
/// \param pBuffer  LCD buffer to fill.
/// \param color  Fill color.
//------------------------------------------------------------------------------
void LCDD_Fill(void *pBuffer, unsigned int color)
{
    unsigned int i;
    unsigned short color16 = RGB24ToRGB16(color);


    LCD_SetCursor((void *)BOARD_LCD_BASE, 0, 0);
    LCD_WriteRAM_Prepare((void *)BOARD_LCD_BASE);
    for (i = 0; i < (BOARD_LCD_WIDTH * BOARD_LCD_HEIGHT); i++) {

        LCD_WriteRAM((void *)BOARD_LCD_BASE, color16);
    }
}
Пример #3
0
/**
  * @brief  Clears the hole LCD.
  * @param  Color: the color of the background.
  * @retval None
  */
void LCD_Clear(uint16_t Color)
{
  uint32_t index = 0;
  
  LCD_SetCursor(0x00, 0x013F); 
  LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
  for(index = 0; index < 76800; index++)
  {
    LCD_WriteRAM(Color);
  }
  LCD_CtrlLinesWrite(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, Bit_SET); 
  
}
Пример #4
0
/*******************************************************************************
* Function Name  : LCD_Clear
* Description    : Clears the hole LCD.
* Input          : Color: the color of the background.
* Output         : None
* Return         : None
*******************************************************************************/
void LCD_Clear(u16 Color)
{
  u32 index = 0;
  
  LCD_SetCursor(0x00, 0x013F); 

  LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */

  for(index = 0; index < 76800; index++)
  {
    LCD->LCD_RAM = Color;
  }  
}
Пример #5
0
/**
  * @brief  Displays a circle.
  * @param  Xpos: specifies the X position.
  * @param  Ypos: specifies the Y position.
  * @param  Radius
  * @retval None
  */
void LCD_DrawCircle(uint8_t Xpos, uint16_t Ypos, uint16_t Radius)
{
  int32_t  D;/* Decision Variable */ 
  uint32_t  CurX;/* Current X Value */
  uint32_t  CurY;/* Current Y Value */ 
  
  D = 3 - (Radius << 1);
  CurX = 0;
  CurY = Radius;
  
  while (CurX <= CurY)
  {
    LCD_SetCursor(Xpos + CurX, Ypos + CurY);
    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
    LCD_WriteRAM(TextColor);
    LCD_SetCursor(Xpos + CurX, Ypos - CurY);
    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
    LCD_WriteRAM(TextColor);
    LCD_SetCursor(Xpos - CurX, Ypos + CurY);
    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
    LCD_WriteRAM(TextColor);
    LCD_SetCursor(Xpos - CurX, Ypos - CurY);
    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
    LCD_WriteRAM(TextColor);
    LCD_SetCursor(Xpos + CurY, Ypos + CurX);
    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
    LCD_WriteRAM(TextColor);
    LCD_SetCursor(Xpos + CurY, Ypos - CurX);
    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
    LCD_WriteRAM(TextColor);
    LCD_SetCursor(Xpos - CurY, Ypos + CurX);
    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
    LCD_WriteRAM(TextColor);
    LCD_SetCursor(Xpos - CurY, Ypos - CurX);
    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
    LCD_WriteRAM(TextColor);
    if (D < 0)
    { 
      D += (CurX << 2) + 6;
    }
    else
    {
      D += ((CurX - CurY) << 2) + 10;
      CurY--;
    }
    CurX++;
  }
}
Пример #6
0
/*******************************************************************************
* Function Name  : LCD_Clear
* Description    : Clears the hole LCD.
* Input          : Color: the color of the background.
* Output         : None
* Return         : None
*******************************************************************************/
void LCD_Clear(u16 Color)
{
  u32 index = 0;

  LCD_SetCursor(0,319);

    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */

  for(index = 0; index < 76800; index++)
  {
    LCD_WriteRAM(Color);
  }
  LCD_WriteRAM_Ready();
}
Пример #7
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�����ַ
}
Пример #8
0
/*******************************************************************************
* Function Name  : LCD_Clear
* Description    : Clears the hole LCD.
* Input          : Color: the color of the background.
* Output         : None
* Return         : None
*******************************************************************************/
void LCD_Clear(u16 Color)
{
    vu32 index = 0;

    LCD_SetCursor(0x00, 0x013F);

    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */

    for(index = 0; index < 76800; index++) {
        LCD_WriteRAM(Color);
    }

    LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET);

}
Пример #9
0
/**
  * @brief  Displays a line.
  * @param Xpos: specifies the X position.
  * @param Ypos: specifies the Y position.
  * @param Length: line length.
  * @param Direction: line direction.
  *   This parameter can be one of the following values: Vertical or Horizontal.
  * @retval None
  */
void LCD_DrawLine(uint8_t Xpos, uint16_t Ypos, uint16_t Length, uint8_t Direction)
{
  uint32_t i = 0;
  
  LCD_SetCursor(Xpos, Ypos);
  if(Direction == Horizontal)
  {
    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
    for(i = 0; i < Length; i++)
    {
      LCD_WriteRAM(TextColor);
    }
  }
  else
  {
    for(i = 0; i < Length; i++)
    {
      LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
      LCD_WriteRAM(TextColor);
      Xpos++;
      LCD_SetCursor(Xpos, Ypos);
    }
  }
}
Пример #10
0
/**
  * @brief  Clears the hole LCD.
  * @param  Color: the color of the background.
  * @retval None
  */
void LCD_Clear(uint16_t Color)
{
	uint32_t index = 0;

	if (LCD_ID == LCD_HX8347D) {
		LCD_SetCursor(0x00, 0x0000);
	} else {
		LCD_SetCursor(0x00, 0x013F);
	}

	/* Prepare to write GRAM */
	LCD_WriteRAM_Prepare();
	for (index = 0; index < 76800; index++) {
		LCD->LCD_RAM = Color;
	}
}
Пример #11
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�����ַ	    
}
int main()
{
	SystemInit();
	if (SysTick_Config(SystemCoreClock / 3119))//1ms 
  { 
    /* Capture error */ 
    while (1);
  }	

  STM_EVAL_LEDInit(LED3);

  STM3240F_LCD_Init();  	
	LCD_Clear(Black);
	LCD_SetColors(Green,Black);
	LCD_SetFont(&Font8x8);

    if(OV9655_Configuration()==0xFF) 
		{
	     LCD_DisplayStringLine(0,0,"Camera Failed");
    }else{
       LCD_DisplayStringLine(0,0,"Camera OK!");
    }
		/* Start Image capture */ 

	LCD_SetDisplayWindow(0, 0, 319, 239);
  LCD_WriteRAM_Prepare();
  DCMI_CaptureCmd(ENABLE); 
  /* Enable DMA transfer */
  DMA_Cmd(DMA2_Stream1, ENABLE);
    /* Enable DCMI interface */
  DCMI_Cmd(ENABLE); 
    /* Start Image capture */ 
  DCMI_CaptureCmd(ENABLE);   
//  Delay(2);
//  DCMI_SingleRandomWrite(OV9655_DEVICE_WRITE_ADDRESS,0x8d, 0x10);//Camera Color Test Mode Enabled
//    temp=DCMI_SingleRandomRead(OV9655_DEVICE_WRITE_ADDRESS,OV9655_COM15);
//		sprintf(data,"Okunan Data=0x%02X",temp);
//		LCD_DisplayStringLine(0,0,data);
	while(1)
	{ 	
		 
 		 
 	}
}
Пример #13
0
/*******************************************************************************
* Function Name  : LCD_DrawMonoPict
* Description    : Displays a monocolor picture.
* Input          : - Pict: pointer to the picture array.
* Output         : None
* Return         : None
*******************************************************************************/
void LCD_DrawMonoPict(uc32 *Pict)
{
    u32 index = 0, i = 0;

    LCD_SetCursor(0, 319);
    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */

    for(index = 0; index < 2400; index++) {
        for(i = 0; i < 32; i++) {
            if((Pict[index] & (1 << i)) == 0x00) {
                LCD_WriteRAM(BackColor);
            } else {
                LCD_WriteRAM(TextColor);
            }
        }
    }
    LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET);

}
Пример #14
0
/**
  * @brief  Draws a vertical line.
  * @param  Xpos: X position
  * @param  Ypos: Y position
  * @param  Length: Line length
  * @retval None
  */
void BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
  uint16_t i = 0;

  /* AM=1 (address is updated in vertical writing direction) */
  LCD_WriteReg(SSD2119_ENTRY_MODE_REG, ENTRY_MODE_VINC);

  LCD_SetCursor(Xpos, Ypos);
  LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */

  for(i = 0; i < Length; i++)
  {
    /* Write 16-bit GRAM Reg */
    LCD_WriteRAM(DrawProp.TextColor);
  }

  /* AM=0 (address is updated in Horizontal writing direction) */
  LCD_WriteReg(SSD2119_ENTRY_MODE_REG, ENTRY_MODE_HINC);
}
Пример #15
0
/*
 * \brief Draw a raw image at given position on LCD.
 *
 * \param x         X-coordinate of image start.
 * \param y         Y-coordinate of image start.
 * \param pImage    Image buffer.
 * \param width     Image width.
 * \param height    Image height.
 */
void LCDD_DrawImage(
    uint32_t x,
    uint32_t y,
    const uint8_t *pImage,
    uint32_t width,
    uint32_t height)
{
    uint32_t row, col;

    for(row = y; row < (y + height); row++) {
        LCD_SetCursor(x, row);
        LCD_WriteRAM_Prepare();
        for(col = x; col < (x + width); col++) {
            LCD_D() = *pImage++;
            LCD_D() = *pImage++;
            LCD_D() = *pImage++;
        }
    }
}
Пример #16
0
void LCD_DrawChar_HX8347A(uint16_t Xpos, uint16_t Ypos, uint16_t codeChar)
{
	uint32_t index = 0, i = 0, numByte, width, bitCounter, ptrByte;
	// Symbol width
	if (codeChar > LCD_Currentfonts->NumSymb) codeChar = 0;
	if (LCD_Currentfonts->Width)
	{
		width = LCD_Currentfonts->Width;
		LCD_SetWindow(Xpos, Ypos, Xpos+width-1, Ypos+LCD_Currentfonts->Height-1);
	}
	else
	{
		width = LCD_Currentfonts->tableSymbWidth[codeChar];
		LCD_SetWindow(Xpos, Ypos, Xpos+width+LCD_Currentfonts->SymbolSpace-1, Ypos+LCD_Currentfonts->Height-1);
	}
	numByte = LCD_Currentfonts->Height * ((width+7)/8);

	LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
	// Draw Char
	for(index = 0; index < numByte; index++)
	{
		bitCounter = 0;
		for(i = 0; i < width; i++)
		{

			if (bitCounter > 7)
			{
				bitCounter = 0;
				index++;
			}
			ptrByte = LCD_Currentfonts->table[LCD_Currentfonts->tableSymbIndex[codeChar]+index];
			if(ptrByte & (1<<bitCounter))
			{
				LCD_WriteRAM(TextColor>>16);
				LCD_WriteRAM(TextColor);
			}
			else
			{
				LCD_WriteRAM(BackColor>>16);
				LCD_WriteRAM(BackColor);
			}
			bitCounter++;
		}
Пример #17
0
/**
  * @brief  Displays picture.
  * @param  pdata: picture address.
  * @param  Xpos: Image X position in the LCD
  * @param  Ypos: Image Y position in the LCD
  * @param  Xsize: Image X size in the LCD
  * @param  Ysize: Image Y size in the LCD
  * @retval None
  */
static void LCD_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata)
{
  uint32_t index = 0, size = 0;

  size = (Xsize * Ysize);

  /* Set Cursor */
  LCD_SetCursor(Xpos, Ypos);

  /* Prepare to write GRAM */
  LCD_WriteRAM_Prepare();

  for(index = 0; index < size; index++)
  {
    /* Write 16-bit GRAM Reg */
    LCD_WriteRAM(*(__IO uint16_t *)pdata);
    pdata += 2;
  }
}
Пример #18
0
void showimage(uint16_t x,uint16_t y) //显示40*40图片
{  
	uint16_t i,j,k;
	uint16_t da;
	k=0;
	for(i=0;i<40;i++)
	{	
		LCD_SetCursor(x,y+i);
		LCD_WriteRAM_Prepare();     			//开始写入GRAM	
		for(j=0;j<40;j++)
		{
			da=qqimage[k*2+1];
			da<<=8;
			da|=qqimage[k*2]; 
			LCD_WR_DATA(da);					
			k++;  			
		}
	}
}
Пример #19
0
/**
  * @brief  Displays a monocolor picture.
  * @param  Pict: pointer to the picture array.
  * @retval None
  */
void LCD_DrawMonoPict(const uint32_t *Pict)
{
  uint32_t index = 0, i = 0;
  LCD_SetCursor(0, 319); 
  LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
  for(index = 0; index < 2400; index++)
  {
    for(i = 0; i < 32; i++)
    {
      if((Pict[index] & (1 << i)) == 0x00)
      {
        LCD_WriteRAM(BackColor);
      }
      else
      {
        LCD_WriteRAM(TextColor);
      }
    }
  }
}
Пример #20
0
/**
  * @brief  Displays a mono-color picture.
  * @param  Pict: pointer to the picture array.
  * @retval None
  */
void BSP_LCD_DrawMonoPict(const uint32_t *Pict)
{
  uint32_t index = 0, i = 0;
  LCD_SetCursor(0, (LCD_PIXEL_WIDTH - 1));
  LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
  for(index = 0; index < 2400; index++)
  {
    for(i = 0; i < 32; i++)
    {
      if((Pict[index] & (1 << i)) == 0x00)
      {
        LCD_WriteRAM(DrawProp.BackColor);
      }
      else
      {
        LCD_WriteRAM(DrawProp.TextColor);
      }
    }
  }
}
Пример #21
0
/*******************************************************************************
* Function Name  : LCD_DrawLine
* Description    : Displays a line.
* Input          : - Xpos: specifies the X position.
*                  - Ypos: specifies the Y position.
*                  - Length: line length.
*                  - Direction: line direction.
*                    This parameter can be one of the following values: Vertical
*                    or Horizontal.
* Output         : None
* Return         : None
*******************************************************************************/
void LCD_DrawLine(u8 Xpos, u16 Ypos, u16 Length, u8 Direction)
{
    u32 i = 0;

    LCD_SetCursor(Xpos, Ypos);

    if(Direction == Horizontal) {
        LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */

        for(i = 0; i < Length; i++) {
            LCD_WriteRAM(TextColor);
        }
        LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET);
    } else {
        for(i = 0; i < Length; i++) {
            LCD_WriteRAMWord(TextColor);
            Xpos++;
            LCD_SetCursor(Xpos, Ypos);
        }
    }
}
Пример #22
0
/**
  * @brief  Clears the hole LCD.
  * @param  Color: the color of the background.
  * @retval None
  */
void LCD_Clear(uint16_t Color)
{
	uint32_t index = 0;

	if (LCDType == LCD_HX8347D) {
		LCD_SetCursor(0, 0);
	} else {
		LCD_SetCursor(0, 319);
	}

	/* Prepare to write GRAM */
	LCD_WriteRAM_Prepare();

	for (index = 0; index < (uint32_t) 320 * 240; index++) {
		LCD_WriteRAM(Color);
	}

	/* Wait until a data is sent(not busy), before config /CS HIGH */
	while (SPI_I2S_GetFlagStatus(LCD_SPI, SPI_I2S_FLAG_BSY) != RESET) ;
	LCD_CtrlLinesWrite(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, Bit_SET);
}
/*******************************************************************************
* Function Name  : LCD_Clear
* Description    : Clears the hole LCD.
* Input          : Color: the color of the background.
* Output         : None
* Return         : None
*******************************************************************************/
void LCD_Clear(uint16_t Color)
{
  uint32_t index = 0;
  
  LCD_SetCursor(0x00, 0x013F); 

  if((LCDType == LCD_ILI9320) || (LCDType == LCD_SPFD5408))
  {
    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
  }

  for(index = 0; index < 76800; index++)
  {
    LCD_WriteRAM(Color);
  }

  if((LCDType == LCD_ILI9320) || (LCDType == LCD_SPFD5408))
  {
    LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET); 
  }  
}
Пример #24
0
//清屏函数
//color:要清屏的填充色
void LCD_Clear(uint16_t color)
{
	uint32_t index=0;      
	//uint32_t totalpoint=lcddev.width;
	//totalpoint*=lcddev.height; 	//得到总点数
	
	LCD_SetCursor(0x00,0x0000);	//设置光标位置 
	LCD_WriteRAM_Prepare();     //开始写入GRAM	
	
	memset(testBuf,color,sizeof(testBuf));
	
	SPILCD_CS_RESET;  //LCD_CS=0
	SPILCD_RS_SET;	
	
	for(index=0;index<64;index++)
	{
		HAL_SPI_Transmit(&hspi1, (uint8_t*)testBuf, 640,200);	
	}
	SPILCD_CS_SET;  //LCD_CS=1		

}  
Пример #25
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�����ַ
}
Пример #26
0
/*******************************************************************************
* Function Name  : LCD_DrawMonoPict
* Description    : Displays a monocolor picture.
* Input          : - Pict: pointer to the picture array.
* Output         : None
* Return         : None
*******************************************************************************/
void LCD_DrawMonoPict(uc8 *Pict)
{
  u32 index = 0, i = 0;

  //LCD_SetCursor(0, 0);

    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */

  for(index = 0; index < (6040); index++)
  {
    for(i = 0; i < 8; i++)
    {
      if((Pict[index] & (1 << i)) == 0x00) {
        LCD_WriteRAM(BackColor);
      }
      else {
        LCD_WriteRAM(TextColor);
      }
    }
  }
  LCD_WriteRAM_Ready();
}
Пример #27
0
//更新LCD显示
void camera_refresh(void)
{
	u32 j;
 	u16 color;	 
	if(ov_sta==2)
	{
		LCD_Scan_Dir(U2D_L2R);		//从上到下,从左到右 
		LCD_SetCursor(0x00,0x0000);	//设置光标位置 
		LCD_WriteRAM_Prepare();     //开始写入GRAM	
 		OV7670_CS=0;	 
 		OV7670_RRST=0;				//开始复位读指针 
		OV7670_RCK=0;
		OV7670_RCK=1;
		OV7670_RCK=0;
		OV7670_RRST=1;				//复位读指针结束 
		OV7670_RCK=1;  
		for(j=0;j<76800;j++)
		{
			GPIOB->CRL=0X88888888;		   
			OV7670_RCK=0; 
			color=OV7670_DATA;		//读数据
			OV7670_RCK=1; 	
			color<<=8;					  
 			OV7670_RCK=0;
			color|=OV7670_DATA;		//读数据		  
			OV7670_RCK=1; 
			GPIOB->CRL=0X33333333;						 	 
			LCD_WR_DATA(color);	 
		}  
 		OV7670_CS=1; 							 
		OV7670_RCK=0; 
		OV7670_RCK=1; 
		EXTI->PR=1<<15;     		//清除LINE8上的中断标志位
		ov_sta=0;					//开始下一次采集
 		ov_frame++; 
		LCD_Scan_Dir(DFT_SCAN_DIR);	//恢复默认扫描方向 	  				 	 
	} 
}	  
Пример #28
0
/*******************************************************************************
* Function Name  : LCD_DrawChar
* Description    : Draws a character on LCD.
* Input          : - Xpos: the Line where to display the character shape.
*                    This parameter can be one of the following values:
*                       - Linex: where x can be 0..9
*                  - Ypos: start column address.
*                  - c: pointer to the character data.
* Output         : None
* Return         : None
*******************************************************************************/
void LCD_DrawChar(u8 Xpos, u16 Ypos, uc16 *c)
{
    vu32 index = 0, i = 0;
    vu8 Xaddress = 0;

    Xaddress = Xpos;

    LCD_SetCursor(Xaddress, Ypos);

    for(index = 0; index < 24; index++) {
        LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */

        for(i = 0; i < 16; i++) {
            if((c[index] & (1 << i)) == 0x00) {
                LCD_WriteRAM(BackColor);
            } else {
                LCD_WriteRAM(TextColor);
            }
        }
        LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET);
        Xaddress++;
        LCD_SetCursor(Xaddress, Ypos);
    }
}
/**
  * @brief  Displays a line.
  * @param  Xpos: specifies the X position.
  * @param  Ypos: specifies the Y position.
  * @param  Length: line length.
  * @param  Direction: line direction.
  *   This parameter can be one of the following values: Vertical or Horizontal.
  * @retval None
  */
void LCD_DrawLine(uint8_t Xpos, uint16_t Ypos, uint16_t Length, uint8_t Direction)
{
  uint32_t i = 0;
  
  LCD_SetCursor(Xpos, Ypos);
  if(Direction == Horizontal)
  { 
    LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
    for(i = 0; i < Length; i++)
    {
      LCD_WriteRAM(TextColor);
    }
    LCD_CtrlLinesWrite(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, Bit_SET);
  }
  else
  {
    for(i = 0; i < Length; i++)
    {
      LCD_WriteRAMWord(TextColor);
      Xpos++;
      LCD_SetCursor(Xpos, Ypos);
    }
  }
}
Пример #30
0
void LCD_ASCII(u16 x,u16 y,u8 p,uint8_t fon, u16 charColor,u16 bkColor)
{
  
  uint32_t index;//地址偏移量  
  uint16_t i,n,end_x;
  FATFS fs;
  FIL	file;
  FRESULT res;
  DIR dirs;
  uint32_t re;
  res = f_mount(0,&fs);
  res = f_opendir(&dirs,(const TCHAR*)"/");//打开根目录
  
  
  
  switch(fon)
  {
  case 12:
    {
      u8 buffer[12]={0};
      index = p*12;
      end_x=x+5;
      res = f_open(&file,(const TCHAR*)"ASCII12.FON",FA_READ);//打开在根目录的字库
      res = f_lseek (&file, index);//设置偏移量
      res = f_read(&file,buffer,12,&re);//读出32字节字模数据
      LCD_WriteReg(CUR_X,x); // .............. CUR_x
      LCD_WriteReg(CUR_Y,y); // .............. CUR_y
      LCD_WriteReg(END_X,end_x); // ............ END_X
      LCD_WriteRAM_Prepare(); // .............. PIXELS
      for(n=0;n<12;n++)
      {
        for (i = 0; i < 6; i++)
        {
          if (buffer[n] & (0x01<<i))
          {
            LCD_WritePoint(charColor);//写有效点
          }
          else
          {
            LCD_WritePoint(bkColor);//写底色
          }
        }
      }
    }
    break;
  case 16:
    {
      u8 buffer[16]={0};
      index = p*16;
      end_x=x+7;
      res = f_open(&file,(const TCHAR*)"ASCII16.FON",FA_READ);//打开在根目录的字库
      res = f_lseek (&file, index);//设置偏移量
      res = f_read(&file,buffer,16,&re);//读出32字节字模数据
      LCD_WriteReg(CUR_X,x); // .............. CUR_x
      LCD_WriteReg(CUR_Y,y); // .............. CUR_y
      LCD_WriteReg(END_X,end_x); // ............ END_X
      LCD_WriteRAM_Prepare(); // .............. PIXELS
      for(n=0;n<16;n++)
      {
        for (i = 0; i < 8; i++)
        {
          if (buffer[n] & (0x01<<i))
          {
            LCD_WritePoint(charColor);//写有效点
          }
          else
          {
            LCD_WritePoint(bkColor);//写底色
          }
        }
      }
    }
    break;
  case 24:
    {
      u8 buffer[48]={0};
      index = p*48;
      end_x=x+11;
      res = f_open(&file,(const TCHAR*)"ASCII24.FON",FA_READ);//打开在根目录的字库
      res = f_lseek (&file, index);//设置偏移量
      res = f_read(&file,buffer,48,&re);//读出32字节字模数据
      LCD_WriteReg(CUR_X,x); // .............. CUR_x
      LCD_WriteReg(CUR_Y,y); // .............. CUR_y
      LCD_WriteReg(END_X,end_x); // ............ END_X
      LCD_WriteRAM_Prepare(); // .............. PIXELS
      for(n=0;n<48;n++)
      {
        for (i = 0; i < 8; i++)
        {
          if (buffer[n] & (0x01<<i))
          {
            LCD_WritePoint(charColor);//写有效点
          }
          else
          {
            LCD_WritePoint(bkColor);//写底色
          }
        }
        for (i = 0; i < 4; i++)
        {
          if (buffer[n+1] & (0x01<<i))
          {
            LCD_WritePoint(charColor);//写有效点
          }
          else
          {
            LCD_WritePoint(bkColor);//写底色
          }
        }
        n+=1;
      }
    }
    break;
  case 32:
    {
      u8 buffer[64]={0};
      index = p*64;
      end_x=x+15;
      res = f_open(&file,(const TCHAR*)"ASCII32.FON",FA_READ);//打开在根目录的字库
      res = f_lseek (&file, index);//设置偏移量
      res = f_read(&file,buffer,64,&re);//读出32字节字模数据
      LCD_WriteReg(CUR_X,x); // .............. CUR_x
      LCD_WriteReg(CUR_Y,y); // .............. CUR_y
      LCD_WriteReg(END_X,end_x); // ............ END_X
      LCD_WriteRAM_Prepare(); // .............. PIXELS
      for(n=0;n<64;n++)
      {
        for (i = 0; i < 8; i++)
        {
          if (buffer[n] & (0x01<<i))
          {
            LCD_WritePoint(charColor);//写有效点
          }
          else
          {
            LCD_WritePoint(bkColor);//写底色
          }
        }
      }
    }
    break;
    
    
  default:break;
  }
  
  f_close(&file);
  f_mount(0,NULL);
}