📄 lcd.lst
字号:
C51 COMPILER V7.50 LCD 07/17/2008 14:38:50 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN ..\output\lcd.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\common\lcd.c LARGE OPTIMIZE(9,SIZE) BROWSE INCDIR(..\..\..\bsp\includ
-e;..\src\include;..\..\include) DEFINE(CONFIG_ASIC) DEBUG OBJECTEXTEND PRINT(.\lcd.lst) OBJECT(..\output\lcd.obj)
line level source
1 #include <string.h>
2 #include "api.h"
*** WARNING C318 IN LINE 2 OF ..\..\common\lcd.c: can't open file 'api.h'
3 //#include "mp3app.h"
4 #include "get_latin2.h"
*** ERROR C129 IN LINE 21 OF ..\..\INCLUDE\GET_LATIN2.H: missing ';' before 'api_bGetLatinFont8x8BMP'
5 #include "lcd.h"
6 #include "get_latin2.h"
7 #include"common.h"
*** WARNING C318 IN LINE 5 OF ..\..\INCLUDE\COMMON.H: can't open file 'types.h'
8
9
10 #define MIN(a,b) ((a) < (b) ? (a) : (b))
11 #define MAX(a,b) ((a) > (b) ? (a) : (b))
12
13 UINT8 lcd_max_str;
14
15 #ifdef loop_show_file_name
INT8 sonename_loop_step;//john 070606
INT8 songname_Chinese_max;//john 070606
INT8 songname_English_max;//john 070606
#endif
20
21 UINT16 fg_color, bg_color;
22 UINT16 bg_pixel[SCREEN_WIDTH];
23 UINT16 pixel_buf[256];
24
25
26 void delay_1ms(void)
27 {
28 UINT16 n;
29
30 for(n = 420; n > 0; n--) {}
31 }
32
33 void delay(UINT16 n)
34 {
35 while(n--)
36 delay_1ms();
37 }
38
39 void writec(UINT8 cmd)
40 {
41 lcd_setcmd(cmd);
42 }
43 void writed(UINT8 lcddata)
44 {
45 lcd_setdata(lcddata);
46 }
47
48 void write2c(UINT8 i, UINT8 j)
49 {
50 writec(i);
51 writec(j);
C51 COMPILER V7.50 LCD 07/17/2008 14:38:50 PAGE 2
52 }
53
54 BOOLEAN lcd_put_data(UINT16 buf, UINT16 size)
55 {
56 return api_bLcdDataMove(buf,size);
57 }
58
59 #if 0
BOOLEAN lcd_get_data(UINT16 buf, UINT16 size)
{
UINT16 i;
UINT8 xdata *ptr = (UINT8 xdata *)buf;
api_vLcdPinSelect();
for(i = 0; i < size; i++) {
LCDC_DMYRDRS = 1;
while(!LCDC_READY);
ptr[i] = LCDC_DATARS1;
}
api_vLcdPinRecover();
return true;
}
#endif
76
77 void lcd_set_rw_area(UINT8 x, UINT8 y, UINT8 w, UINT8 h)
78 {
79 api_vLcdPinSelect();
80
81 writec(0x43);
82 writec(x); // start x
83 writec(x + w - 1); // end x
84
85 writec(0x42);
86 writec(y+2); // start y
87 writec(y + h + 1 ); // end y
88 api_vLcdPinRecover();
89 }
90
91 void lcd_set_disply_mode(UINT8 disply_mode,UINT8 scan_direction )
92 {
93 api_vLcdPinSelect();
94 writec(0x40);
95 writec(disply_mode); //显示模式
96 writec(0x10);
97 writec(scan_direction); // 扫描方向 22 和 26相反
98 api_vLcdPinRecover();
99 }
100
101 /*
102 void lcd_set_rw_area1(UINT8 x, UINT8 y, UINT8 w, UINT8 h)
103 {
104 api_vLcdPinSelect();
105
106 writec(X_ADDR_AREA_SET);
107 writec(x); // start x
108 writec(x + w - 1); // end x
109
110 writec(Y_ADDR_AREA_SET);
111 writec(y); // start y
112 writec(y + h - 1); // end y
113
C51 COMPILER V7.50 LCD 07/17/2008 14:38:50 PAGE 3
114 api_vLcdPinRecover();
115 }
116 */
117
118 BOOLEAN lcd_putc_8x8(UINT8 x, UINT8 y, UINT8 c)
119 {
120 UINT8 i, j, w, h;
121 UINT16 xdata *pixel = pixel_buf;
122
123 if(x >= XRES || y >= YRES)
124 return false;
125
126 w = MIN(8, XRES - x);
127 h = MIN(8, YRES - y);
128
129 lcd_set_rw_area(x, y, w, h);
130
131 api_bGetLatinFont8x8BMP(c);
132
133 for(j = 0; j < h; j++) {
134 for(i = 0; i < w; i++) {
135 if((BitMapData[i] >> j) & 0x1)
136 *pixel++ = fg_color;
137 else
138 {
139 *pixel++ = bg_color;
140 }
141 }
142 }
143
144 lcd_put_data((UINT16)pixel_buf, w*h*2);
145 return true;
146 }
147
148 BOOLEAN lcd_putc_8x16(UINT8 x, UINT8 y, UINT8 c)
149 {
150 UINT8 i, j, w, h;
151
152 UINT16 xdata *pixel = pixel_buf;
153
154 api_bGetLatinFont8x16BMP(c);
155
156 if(x >= XRES || y >= YRES)
157 return false;
158
159 w = MIN(8, XRES - x);
160 h = MIN(16, YRES - y);
161
162 lcd_set_rw_area(x, y, w, h);
163
164 for(j = 0; j < 8; j++) {
165 for(i = 8; i < 16; i++) {
166 if((BitMapData[i] >> j) & 0x1)
167 *pixel++ = fg_color;
168 else
169 {
170 *pixel++ = bg_color;
171 }
172 }
173 }
174
175 for(j = 0; j < 8; j++) {
C51 COMPILER V7.50 LCD 07/17/2008 14:38:50 PAGE 4
176 for(i = 0; i < w; i++) {
177 if((BitMapData[i] >> j) & 0x1)
178 *pixel++ = fg_color;
179 else
180 *pixel++ = bg_color;
181 }
182 }
183
184 lcd_put_data((UINT16)pixel_buf, (UINT16)w*h*2);
185 return true;
186 }
187
188 BOOLEAN lcd_putc_16x16(UINT8 x, UINT8 y, UINT16 gcode)
189 {
190 UINT8 i, j, w, h;
191 UINT16 xdata *pixel = (UINT16 xdata *)&pixel_buf[0];
192
193 if(x >= XRES || y >= YRES)
194 return false;
195
196 if(gcode) {
197 if(!api_bGetUniFont16x16BMP(gcode))
198 return false;
199 }
200
201 w = MIN(16, XRES - x);
202 h = MIN(16, YRES - y);
203
204 lcd_set_disply_mode(0x08,0x22);
205
206 lcd_set_rw_area(x,142 - y, w, h); //or 108
207
208 for(j = 0; j < h; j++) {
209 for(i = 0; i < w; i++) {
210 if((BitMapData[(i << 1) + (j >> 3)] >> (j & 0x7)) & 0x1)
211 *pixel++ = fg_color;
212 else
213 {
214 //if(!textoutmode)
215 *pixel++ = bg_color;
216 }
217 }
218 }
219
220 lcd_put_data((UINT16)pixel_buf, (UINT16)w*h*2);
221
222 //CDIR = 0;
223 lcd_set_disply_mode(0x00,0x22);
224
225 return true;
226 }
227
228 void lcd_puts(UINT8 x, UINT8 y, UINT8 *str, UINT8 fontsize)
229 {
230
231 INT8S data r1;
232 UINT8 data n;
233
234 n = 0;
235 r1 = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -