comparison src/cs/drivers/drv_app/r2d/lcds/D_Sample/r2d_task_i.c @ 0:b6a5e36de839

src/cs: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:39:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:b6a5e36de839
1 #include "r2d/lcds/d_sample/r2d_tfd_lcd.h"
2 #include "rvm/rvm_use_id_list.h"
3
4 #define RGB(R, G, B) ( (((unsigned char)(R) & 0xf8) << 8) | (((unsigned char)(G) & 0xfc) << 3) | (((unsigned char)(B) & 0xf8) >> 3) )
5
6 void r2d_lcd_power_on(void)
7 {
8 }
9
10 void r2d_lcd_power_off(void)
11 {
12 }
13
14 void r2d_refresh(void)
15 {
16 UINT16 i,j;
17
18 #ifdef CONFIG_TARGET_DSAMPLE
19
20 UINT32 v;
21 UINT32 *p;
22 INT16 x1,x2,y1,y2,de,ds;
23 UINT32 a,b,c,d,e,f;
24
25 p=r2d_g_framebuffer->p_memory_words;
26
27 #if (R2D_REFRESH == R2D_HORIZONTAL)
28
29 LCD_activate;
30
31 x1=(r2d_update_ul_x>>1)<<1; //0
32 x2=((r2d_update_br_x>>1)<<1)+1; //174;
33
34 ds=(x1>>1);
35 de=R2D_MWWIDTH-(x2>>1)-1; // WHY -1, is formula right ????
36
37 y1=r2d_update_ul_y; //0
38 y2=r2d_update_br_y; //219
39
40 //sprintf(debug,"%d,%d,%d,%d",x1,y1,x2,y2);
41 //rvf_send_trace(debug,strlen(debug), NULL_PARAM,
42 // RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID );
43
44 LCD_cmd (LCD_SD_PSET); // set area devoted to MPU interface
45 LCD_data (y1 & 0xff);
46 LCD_data (y1 >> 8);
47 LCD_data (y2 & 0xff);
48 LCD_data (y2 >> 8);
49
50 LCD_cmd (LCD_SD_CSET); // set area devoted to MPU interface
51 LCD_data ((x1+2) & 0xff);
52 LCD_data ((x1+2) >> 8);
53 LCD_data ((x2+2) & 0xff);
54 LCD_data ((x2+2) >> 8);
55
56
57 LCD_cmd(LCD_RAMWR);
58 p=p+y1*R2D_MWWIDTH;
59
60 for(i=y1;i<=y2;i++)
61 {
62 p+=ds;
63 for(j=(x1>>1);j<=(x2>>1);j++)
64 {
65 v=*p++;
66 v=~v;
67
68 /*white*/
69 /*v=0xffffffff*/
70
71 /*black*/
72 /*v = 0x00000000*/
73
74 /* The code below is a temporary fix for a problem with the LCD drivers.
75 * Currently, the LCD can only display colors in the range 0x0000 - 0xad55
76 * The code below maps pixel values into this range (divide by 2)
77 * Ideally, Epsom should provide a new GCP64 array to allow display of all
78 * colors. a-hill@ti.com*/
79
80 #if 0
81 if(v!=0xffffffff)
82 {
83
84 a = ((v&0xf8000000)>>1)&0xf8000000;
85 b = ((v&0x07e00000)>>1)&0x07e00000;
86 c= ((v&0x001f0000)>>1)&0x001f0000;
87
88 d = ((v&0x0000f800)>>1)&0x0000f800;
89 e = ((v&0x000007e0)>>1)&0x000007e0;
90 f= ((v&0x0000001f)>>1)&0x0000001f;
91
92 v = a|b|c|d|e|f;
93 }
94 #endif
95
96 LCD_data(v&0x0FFFF);
97 LCD_data(v>>16);
98
99
100 }
101 p+=de;
102
103
104
105 }
106
107 LCD_deactivate;
108 #endif
109 #endif
110
111 r2d_check_and_send_event(r2d_g_framebuffer);
112 r2d_reinit_update_region();
113
114 }