📄 lcd1.lst
字号:
C51 COMPILER V7.50 LCD1 09/05/2008 14:57:49 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE LCD1
OBJECT MODULE PLACED IN ..\output\output_bin\output_picture\lcd1.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\code\common\lcd1.c LARGE OPTIMIZE(9,SIZE) BROWSE INCDIR(..\..\..\bsp\
-include;..\..\code\ap_picture\src\include;..\..\code\global;..\..\code\include) DEFINE(CONFIG_ASIC,dynamic_load) DEBUG O
-BJECTEXTEND PRINT(..\output\output_bin\output_picture\lcd1.lst) OBJECT(..\output\output_bin\output_picture\lcd1.obj)
line level source
1 #include <string.h>
2 #include "api.h"
3 //#include "mp3app.h"
4 #include "get_latin2.h"
5 #include "lcd.h"
6 #include "get_latin2.h"
7 #include"common.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 //extern unsigned char code font8x16[];
26
27 void delay_1ms(void)
28 {
29 1 UINT16 n;
30 1
31 1 for(n = 420; n > 0; n--) {}
32 1 }
33
34 void delay(UINT16 n)
35 {
36 1 while(n--)
37 1 delay_1ms();
38 1 }
39
40 void writec(UINT8 cmd)
41 {
42 1 lcd_setcmd(cmd);
43 1 }
44 void writed(UINT8 lcddata)
45 {
46 1 lcd_setdata(lcddata);
47 1 }
48
49 void write2c(UINT8 i, UINT8 j)
50 {
51 1 writec(i);
52 1 writec(j);
53 1 }
C51 COMPILER V7.50 LCD1 09/05/2008 14:57:49 PAGE 2
54
55 BOOLEAN lcd_put_data(UINT16 buf, UINT16 size)
56 {
57 1 return api_bLcdDataMove(buf, size);
58 1 }
59
60 #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
77
78 void lcd_set_rw_area(UINT8 x, UINT8 y, UINT8 w, UINT8 h)
79 {
80 1 api_vLcdPinSelect();
81 1
82 1 writec(0x43);
83 1 writec(x); // start x
84 1 writec(x + w - 1); // end x
85 1
86 1 writec(0x42);
87 1 writec(y+2); // start y
88 1 writec(y + h + 1 ); // end y
89 1 api_vLcdPinRecover();
90 1 }
91
92 void lcd_set_disply_mode(UINT8 disply_mode,UINT8 scan_direction )
93 {
94 1 api_vLcdPinSelect();
95 1 writec(0x40);
96 1 writec(disply_mode); //显示模式
97 1 writec(0x10);
98 1 writec(scan_direction); // 扫描方向 22 和 26相反
99 1 api_vLcdPinRecover();
100 1 }
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
114 api_vLcdPinRecover();
115 }
C51 COMPILER V7.50 LCD1 09/05/2008 14:57:49 PAGE 3
116 */
117 BOOLEAN lcd_putc_8x8(UINT8 x, UINT8 y, UINT8 c)
118 {
119 1 UINT8 i, j, w, h;
120 1 UINT16 xdata *pixel = pixel_buf;
121 1
122 1 if(x >= XRES || y >= YRES)
123 1 return false;
124 1
125 1 w = MIN(8, XRES - x);
126 1 h = MIN(8, YRES - y);
127 1
128 1 lcd_set_rw_area(x, y, w, h);
129 1
130 1 api_bGetLatinFont8x8BMP(c);
131 1
132 1 for(j = 0; j < h; j++) {
133 2 for(i = 0; i < w; i++) {
134 3 if((BitMapData[i] >> j) & 0x1)
135 3 *pixel++ = fg_color;
136 3 else
137 3 {
138 4 *pixel++ = bg_color;
139 4 }
140 3 }
141 2 }
142 1
143 1 lcd_put_data((UINT16)pixel_buf, w*h*2);
144 1 return true;
145 1 }
146
147 BOOLEAN lcd_putc_8x16(UINT8 x, UINT8 y, UINT8 c)
148 {
149 1 UINT8 i, j, w, h;
150 1
151 1 UINT16 xdata *pixel = pixel_buf;
152 1
153 1 api_bGetLatinFont8x16BMP(c);
154 1
155 1 if(x >= XRES || y >= YRES)
156 1 return false;
157 1
158 1 w = MIN(8, XRES - x);
159 1 h = MIN(16, YRES - y);
160 1
161 1 lcd_set_rw_area(x, y, w, h);
162 1
163 1 for(j = 0; j < 8; j++) {
164 2 for(i = 8; i < 16; i++) {
165 3 if((BitMapData[i] >> j) & 0x1)
166 3 *pixel++ = fg_color;
167 3 else
168 3 {
169 4 *pixel++ = bg_color;
170 4 }
171 3 }
172 2 }
173 1
174 1 for(j = 0; j < 8; j++) {
175 2 for(i = 0; i < w; i++) {
176 3 if((BitMapData[i] >> j) & 0x1)
177 3 *pixel++ = fg_color;
C51 COMPILER V7.50 LCD1 09/05/2008 14:57:49 PAGE 4
178 3 else
179 3 *pixel++ = bg_color;
180 3 }
181 2 }
182 1
183 1 lcd_put_data((UINT16)pixel_buf, (UINT16)w*h*2);
184 1 return true;
185 1 }
186
187 BOOLEAN lcd_putc_16x16(UINT8 x, UINT8 y, UINT16 gcode)
188 {
189 1 UINT8 i, j, w, h;
190 1 UINT16 xdata *pixel = (UINT16 xdata *)&pixel_buf[0];
191 1
192 1 if(x >= XRES || y >= YRES)
193 1 return false;
194 1
195 1 if(gcode) {
196 2 if(!api_bGetUniFont16x16BMP(gcode))
197 2 return false;
198 2 }
199 1
200 1 w = MIN(16, XRES - x);
201 1 h = MIN(16, YRES - y);
202 1
203 1 lcd_set_disply_mode(0x08,0x22);
204 1
205 1 lcd_set_rw_area(x,142 - y, w, h); //or 108
206 1
207 1 for(j = 0; j < h; j++) {
208 2 for(i = 0; i < w; i++) {
209 3 if((BitMapData[(i << 1) + (j >> 3)] >> (j & 0x7)) & 0x1)
210 3 *pixel++ = fg_color;
211 3 else
212 3 {
213 4 //if(!textoutmode)
214 4 *pixel++ = bg_color;
215 4 }
216 3 }
217 2 }
218 1
219 1 lcd_put_data((UINT16)pixel_buf, (UINT16)w*h*2);
220 1
221 1 //CDIR = 0;
222 1 lcd_set_disply_mode(0x00,0x22);
223 1
224 1 return true;
225 1 }
226
227 void lcd_puts(UINT8 x, UINT8 y, UINT8 *str, UINT8 fontsize)
228 {
229 1
230 1 INT8S data r1;
231 1 UINT8 data n;
232 1
233 1 n = 0;
234 1 r1 = 0;
235 1 api_s8GetFont16x16BMP(0, TRUE);
236 1
237 1 while(*str != '\0') {
238 2 if(n >= lcd_max_str)
239 2 return;
C51 COMPILER V7.50 LCD1 09/05/2008 14:57:49 PAGE 5
240 2
241 2 if(fontsize == FONTSIZE_8x8) {
242 3 if(lcd_putc_8x8(x, y, *str++)) {
243 4 x += 8;
244 4 n++;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -