[C] 纯文本查看 复制代码 void LCD_WR_REG(uint16_t reg)
{
LCD->LCD_REG=reg;//写入要写的寄存器序号
}
void LCD_WR_DATA(uint16_t data)
{
LCD->LCD_RAM=data;
}
void LCD_Address_Set(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2)
{
LCD_WR_REG(0x2a);//列地址设置
LCD_WR_DATA(x1>>8);
LCD_WR_DATA(x1&0xff);
LCD_WR_DATA(x2>>8);
LCD_WR_DATA(x2&0xff);
LCD_WR_REG(0x2b);//行地址设置
LCD_WR_DATA(y1>>8);
LCD_WR_DATA(y1&0xff);
LCD_WR_DATA(y2>>8);
LCD_WR_DATA(y2&0xff);
LCD_WR_REG(0x2c);//储存器写
}
void LCD_Fill(uint16_t xsta,uint16_t ysta,uint16_t xend,uint16_t yend,uint16_t color)
{
uint16_t i,j;
LCD_Address_Set(xsta,ysta,xend,yend);//设置显示范围
for(i=ysta;i<yend;i++)
{
for(j=xsta;j<xend;j++)
{
LCD_WR_DATA(color);
}
}
}
void Test_Color(void)
{
LCD_Fill(0,0,lcddev.width,lcddev.height,WHITE);
delay_ms(1000);
LCD_Fill(0,0,lcddev.width,lcddev.height,BLACK);
delay_ms(1000);
LCD_Fill(0,0,lcddev.width,lcddev.height,RED);
delay_ms(1000);
LCD_Fill(0,0,lcddev.width,lcddev.height,GREEN);
delay_ms(1000);
LCD_Fill(0,0,lcddev.width,lcddev.height,BLUE);
delay_ms(1000);
} |