view src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i.c @ 276:4221c724c664

R2D: preparations for adding LCD hardware suspend handling
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 07 Sep 2021 21:05:38 +0000
parents c905daaff834
children
line wrap: on
line source

#include "r2d/lcds/luna/r2d_luna_lcd.h"

void r2d_lcd_power_on(void)
{
}

void r2d_lcd_power_off(void)
{
}

void r2d_refresh(void)
{
	UINT16 i,j;
	UINT32 v;
	UINT32  *p;
	INT16 x1,x2,y1,y2,de,ds;

	p=r2d_g_framebuffer->p_memory_words;
    
	x1=(r2d_update_ul_x>>1)<<1;  //0
	x2=((r2d_update_br_x>>1)<<1)+1; //174;

	ds=(x1>>1);
	de=R2D_MWWIDTH-(x2>>1)-1; // WHY -1, is formula right ????

	y1=r2d_update_ul_y; //0
	y2=r2d_update_br_y; //219

	if (y1 > y2)
		return;
	r2d_reinit_update_region();

	/* set window area */
	LCD_REG_WR(0x36, x2);
	LCD_REG_WR(0x37, x1);
	LCD_REG_WR(0x38, y2);
	LCD_REG_WR(0x39, y1);
	/* set current write address */
	LCD_REG_WR(0x20, x1);
	LCD_REG_WR(0x21, y1);
	/* set up for GRAM write */
	LCD_IR = 0x22;

	p=p+y1*R2D_MWWIDTH;

	for(i=y1;i<=y2;i++)
	{
		p+=ds;
		for(j=(x1>>1);j<=(x2>>1);j++)
		{
			v=*p++;
			v=~v;

			/*white*/
			/*v=0xffffffff*/
			/*black*/
			/*v=0x00000000*/

			LCD_DR = v&0x0FFFF;
			LCD_DR = v>>16;
		}	    
		p+=de;
	} 
}