FreeCalypso > hg > ffs-editor
comparison src/cs/drivers/drv_app/r2d/lcd_functions.c @ 0:92470e5d0b9e
src: partial import from FC Selenite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 15 May 2020 01:28:16 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:92470e5d0b9e |
---|---|
1 /************************************************************************************ | |
2 * lcd_functions.c : contains low level driver for the lcd * | |
3 * * | |
4 * * | |
5 * Author: Davide Carpegna * | |
6 * * | |
7 * version: 1.0 * | |
8 * * | |
9 * Date: 22/09/2000 * | |
10 * (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved * | |
11 * * | |
12 * --------------------------------------------------------------------------------- * | |
13 * * | |
14 * History: * | |
15 * * | |
16 * 10/18/2001 - Updated for R2D by Christophe Favergeon * | |
17 * * | |
18 ************************************************************************************/ | |
19 | |
20 #include "rv/general.h" | |
21 #include "rvf/rvf_api.h" | |
22 #include "r2d/r2d_config.h" | |
23 #include "r2d/r2d.h" | |
24 #include "r2d/lcd_functions.h" | |
25 #include <string.h> | |
26 | |
27 extern T_R2D_GC_PTR r2d_g_lcd_gc; | |
28 extern T_RVF_MB_ID r2d_mb_id; | |
29 | |
30 | |
31 /******************** FUNCTIONS **********************************************/ | |
32 | |
33 | |
34 | |
35 /********************************************************************************/ | |
36 /* Function Name: LCD_Clear_ll */ | |
37 /* */ | |
38 /* Purpose:low level driver to clear all the lcd */ | |
39 /* */ | |
40 /* */ | |
41 /* Input Parameters: None */ | |
42 /* Output Parameters: */ | |
43 /* None */ | |
44 /********************************************************************************/ | |
45 | |
46 void LCD_Clear_ll (void) | |
47 { | |
48 if (r2d_g_lcd_gc!=NULL) | |
49 r2d_erase(r2d_g_lcd_gc); | |
50 } | |
51 | |
52 /********************************************************************************/ | |
53 /* Function Name: LCD_Init_ll */ | |
54 /* */ | |
55 /* Purpose:low level driver to init the lcd */ | |
56 /* The LCD is initialized by R2D. This routine is now just only clearing */ | |
57 /* the LCD */ | |
58 /* */ | |
59 /* */ | |
60 /* Input Parameters: None */ | |
61 /* Output Parameters: */ | |
62 /* None */ | |
63 /********************************************************************************/ | |
64 | |
65 void LCD_Init_ll(void) | |
66 { | |
67 | |
68 if (r2d_g_lcd_gc!=NULL) | |
69 r2d_erase(r2d_g_lcd_gc); | |
70 | |
71 } | |
72 | |
73 /********************************************************************************/ | |
74 /* Function Name: LCD_Set_Column */ | |
75 /* */ | |
76 /* Purpose:low level driver to revert the axis in the lcd */ | |
77 /* revert the horizontal coordinate */ | |
78 /* */ | |
79 /* Input Parameters: UINT8 x */ | |
80 /* Output Parameters: */ | |
81 /* UINT8 */ | |
82 /********************************************************************************/ | |
83 | |
84 UINT8 LCD_Set_Column(UINT8 x) | |
85 { | |
86 return (83-x); | |
87 } | |
88 | |
89 /********************************************************************************/ | |
90 /* Function Name: LCD_Set_Row_Pixel */ | |
91 /* */ | |
92 /* Purpose:low level driver to revert the axis in the lcd */ | |
93 /* revert the vertical coordinates in pixel */ | |
94 /* */ | |
95 /* Input Parameters: UINT8 y */ | |
96 /* Output Parameters: */ | |
97 /* UINT8 */ | |
98 /********************************************************************************/ | |
99 | |
100 UINT8 LCD_Set_Row_Pixel(UINT8 y) | |
101 { | |
102 return (47-y); | |
103 } | |
104 /********************************************************************************/ | |
105 /* Function Name: LCD_Set_Row */ | |
106 /* */ | |
107 /* Purpose:low level driver to revert the axis in the lcd */ | |
108 /* revert the vertical coordinates in row */ | |
109 /* */ | |
110 /* Input Parameters: UINT8 y */ | |
111 /* Output Parameters: */ | |
112 /* UINT8 */ | |
113 /********************************************************************************/ | |
114 | |
115 UINT8 LCD_Set_Row(UINT8 y) | |
116 { | |
117 return (5-y); | |
118 } | |
119 | |
120 | |
121 /********************************************************************************/ | |
122 /* Function Name: LCD_Write_String */ | |
123 /* */ | |
124 /* Purpose:low level driver to write a string in the lcd */ | |
125 /* */ | |
126 /* */ | |
127 /* Input Parameters: row,column,string videomode */ | |
128 /* Output Parameters: */ | |
129 /* None */ | |
130 /********************************************************************************/ | |
131 | |
132 void LCD_Write_String(UINT8 row, UINT8 column, char *string, T_VIDEO_MODE mode) | |
133 { | |
134 // UINT8 j,l,k,X,Y; | |
135 // char asciicharacter; | |
136 // char new_char; | |
137 | |
138 INT16 ascent,descent,leading;//,h; | |
139 T_R2D_UTF16 *text; | |
140 | |
141 if (r2d_g_lcd_gc!=NULL) | |
142 { | |
143 | |
144 r2d_get_font_info(r2d_g_lcd_gc,&ascent,&descent,&leading); | |
145 | |
146 | |
147 r2d_set_drawing_mode(r2d_g_lcd_gc,R2D_COPY_MODE); | |
148 | |
149 text=r2d_new_unicode_from_cstring(r2d_mb_id,(unsigned char*)string); | |
150 | |
151 | |
152 if (mode) | |
153 { | |
154 T_R2D_ARGB_COLOR bcol,fcol; | |
155 // T_R2D_DRAWING_MODE mode; | |
156 UINT16 text_width; | |
157 | |
158 bcol=r2d_get_background_color(r2d_g_lcd_gc); | |
159 fcol=r2d_get_foreground_color(r2d_g_lcd_gc); | |
160 r2d_set_background_color_with_argb(r2d_g_lcd_gc,0,0,0,0); | |
161 r2d_set_foreground_color_with_argb(r2d_g_lcd_gc,0,255,255,255); | |
162 | |
163 r2d_get_text_width(r2d_g_lcd_gc,text,&text_width); | |
164 | |
165 r2d_draw_text(r2d_g_lcd_gc,(INT16)(column*6),(INT16)((row+1)*8),text); | |
166 r2d_set_background_color(r2d_g_lcd_gc,bcol); | |
167 r2d_set_foreground_color(r2d_g_lcd_gc,fcol); | |
168 } | |
169 else | |
170 r2d_draw_text(r2d_g_lcd_gc,(INT16)(column*6),(INT16)((row+1)*8),text); | |
171 rvf_free_buf((void*)text); | |
172 } | |
173 } | |
174 | |
175 /********************************************************************************/ | |
176 /* Function Name: LCD_Write_Center */ | |
177 /* */ | |
178 /* Purpose:low level driver to write a string in the screen center */ | |
179 /* */ | |
180 /* */ | |
181 /* Input Parameters: string */ | |
182 /* Output Parameters: */ | |
183 /* None */ | |
184 /********************************************************************************/ | |
185 | |
186 void LCD_Write_Center( char *string) | |
187 { | |
188 | |
189 UINT16 i; | |
190 INT16 j; | |
191 char *p; | |
192 j=0; | |
193 p=string; | |
194 while(*p!='\0') | |
195 { | |
196 j++; | |
197 p++; | |
198 } | |
199 | |
200 i=(R2D_WIDTH-((j<<2)+(j<<1)))>>1; | |
201 if (i<0) | |
202 i=0; | |
203 i=((i*0x2A)+0x80)>>8; // i/6 in Q8 | |
204 LCD_Write_String(Y_CENTER,(UINT8) i,string,NORMAL); | |
205 } | |
206 | |
207 | |
208 | |
209 | |
210 | |
211 | |
212 | |
213 | |
214 | |
215 | |
216 | |
217 | |
218 | |
219 | |
220 | |
221 | |
222 | |
223 | |
224 | |
225 |