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