#include "r2d/lcds/bw_d_sample/r2d_tfd_lcd.h"

void r2d_lcd_power_on(void)
{
}

void r2d_lcd_power_off(void)
{
}

void r2d_refresh(void)
{
  UINT16 i,j,k;


  
  UINT32 v;
  UINT32  *p;
  INT16 r,g,b;
	

	
    	
    // rvf_send_trace("R2D REFRESH",strlen("R2D REFRESH"), NULL_PARAM, 
	//		   RV_TRACE_LEVEL_DEBUG_HIGH, TRACE_XXX );

	p=r2d_g_framebuffer->p_memory_words;
    

	//LCD_cmd(LCD_DISOFF);
	LCD_activate;
	LCD_cmd(LCD_RAMWR);
	i=0;
	while(i<R2D_HEIGHT)
	{
	  j=0;
	  while(j<R2D_MWWIDTH-1)
	  {
            v=*p++;
			

			for(k=0;k<32;k++)
			{
                if (v&1)
			      LCD_data(0x0000);
				else
                  LCD_data(0x0FFFF);
				v=v>>1;
			}
		    	  
			j++;	  
	  }	

	  v=*p++;
			

	  for(k=0;k<16;k++)
	  {
          if (v&1)
			  LCD_data(0x0000);
		  else
              LCD_data(0x0FFFF);
		  v=v>>1;
	  }
	  
	  
            
      
	  i++;
	  
    } 
	//LCD_cmd(LCD_DISON);
	LCD_deactivate;

   
   r2d_reinit_update_region();

}