初级会员

- 积分
- 105
- 金钱
- 105
- 注册时间
- 2016-3-30
- 在线时间
- 17 小时
|
1金钱
以下是两个函数 屏为 320X240 水平X 方向递增 纵向Y地址递增
void LCD_SetDisplayWindow(u8 Xpos, u16 Ypos, u8 Height, u16 Width)
{
/* Horizontal GRAM Start Address */
if(Xpos >= Height)
{
LCD_WriteReg(R80, (Xpos - Height + 1));
}
else
{
LCD_WriteReg(R80, 0);
}
/* Horizontal GRAM End Address */
LCD_WriteReg(R81, Xpos);
/* Vertical GRAM Start Address */
if(Ypos >= Width)
{
LCD_WriteReg(R82, (Ypos - Width + 1));
}
else
{
LCD_WriteReg(R82, 0);
}
/* Vertical GRAM End Address */
LCD_WriteReg(R83, Ypos);
LCD_SetCursor(Xpos, Ypos);
}
void LCD_DrawPicture(const u8* picture)
{
int index;
LCD_SetCursor(0x00, 0x0000);
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
for(index = 0; index < 76800; index++)
{
LCD->LCD_RAM = picture[2*index+1]<<8|picture[2*index];
}
}
|
|