📄 user_main.lst
字号:
167 1 }
168
169 void event_init_startup(void);
170 void event_usb_cable_out(void)
171 {
172 1 }
173
174 void event_usb_cable_in(void)
175 {
176 1 api_vLoad(Code_USER13,1);
177 1 }
C51 COMPILER V7.50 USER_MAIN 08/18/2008 13:49:51 PAGE 4
178
179 void event_quarter_sec(void)
180 {
181 1 close_volume();
182 1
183 1 vKeyTimeOut();
184 1
185 1 if(usb_plug)
186 1 {
187 2 ui_show_charge();
188 2 }
189 1
190 1 if(batt_count++ > 6 )
191 1 {
192 2 batt_count = 0;
193 2 if(!usb_plug)
194 2 ui_show_batt();
195 2 }
196 1
197 1 if(vol_flag && curr_screen->id == SCREEN_FM)
198 1 {
199 2 if(_flash)
200 2 {
201 3 _flash = 0;
202 3 bResShowPic(MVOL_CLR,66,144);
203 3
204 3 }
205 2 else
206 2 {
207 3 _flash = 1;
208 3 ui_show_vol();
209 3 }
210 2
211 2 }
212 1
213 1 if(api_u8GetBatteryRemain() <= BATTERY_LEVEL_20)
214 1 {
215 2 low_batt_count++;
216 2 }
217 1 else
218 1 {
219 2 low_batt_count = 0;
220 2 }
221 1 if(low_batt_count==6) //shut down
222 1 {
223 2 close_volume();
224 2 bResShowPic(LOWPOWER,0,0);
225 2 delay(10000);
226 2 delay(10000);
227 2 if(record_start)
228 2 {
229 3 api_bRecordStop();
230 3 // bRadioStop();
231 3 ui_show_message(RSAVING);
232 3 }
233 2 vShutDown();
234 2 }
235 1 init_volume();
236 1
237 1
238 1 }
239
C51 COMPILER V7.50 USER_MAIN 08/18/2008 13:49:51 PAGE 5
240 void event_dsp_exception(void)
241 {
242 1 #if 0
if((curr_screen->id == SCREEN_MOVIE && screen_level == SCREEN_LEVEL_MOVIE_PLAY) ||
(curr_screen->id == SCREEN_PICTURE && screen_level == SCREEN_LEVEL_JPEG_DISP)) {
Print("Fmt err\n");
lcd_set_rw_area(SCREEN_START_X, SCREEN_START_Y, SCREEN_WIDTH, SCREEN_HEIGHT);
key_process(KEY(NEXT));
}
#endif
250 1 }
251
252 void event_loop_epilog(void)
253 {
254 1
255 1 }
256
257 void event_init_startup(void)
258 {
259 1 #ifndef CONFIG_NAND_LARGEPAGE
/* Nothing, just for demo "api_vGetFreeXdataInfo()" in small page flash. */
INT16U free_size, free_start;
api_vGetFreeXdataInfo(&free_size, &free_start);
free_mem_ptr = free_start;
free_mem_end_ptr = free_mem_ptr + free_size;
file_entry = (INT32U *)my_malloc(FILE_ENTRY_MAX * sizeof(UINT32));
#endif
269 1 api_vKeyMapRegister(key_map);
270 1 api_vSetPassCount(20);
271 1 api_vBatteryLevelRegister(battery_map);
272 1
273 1 api_bLoadPreferenceData((void*)(&tUserPreference),sizeof(USER_PREFERENCE_T));
274 1
275 1
276 1 if(tUserPreference.u8LanguageId>4)
277 1 api_bSetLanguage(0);
278 1 else
279 1 api_bSetLanguage(tUserPreference.u8LanguageId);
280 1 //tUserPreference.u8Volume = 24;
281 1 if(api_bChangeDisk(DISK_SD))
282 1 have_sd = 1;
283 1 else
284 1 have_sd = 0;
285 1
286 1 api_bChangeDisk(DISK_NAND);
287 1
288 1 u16TimerCount = 0;
289 1 record_start = 0;
290 1 fm_init = 1;
291 1 //lcd_init();
292 1 gui_init();
293 1 screen_level = SCREEN_LEVEL_MUSIC_STOP;
294 1 screen_map(SCREEN_FM);
295 1 }
296
297
298 typedef void event_handler(void);
299
300 static code event_handler *handlers[] = {
301 event_init_startup, // EVENT_INIT_STARTUP
C51 COMPILER V7.50 USER_MAIN 08/18/2008 13:49:51 PAGE 6
302 NULL, // EVENT_WATCHDOG_UP
303 NULL, // EVENT_LOOP_PROLOG
304 event_loop_epilog, // EVENT_LOOP_EPILOG
305 NULL, // EVENT_OCTANT_SEC
306 event_quarter_sec, // EVENT_QUARTER_SEC
307 event_usb_cable_in, // EVENT_USB_CABLE_IN
308 NULL, // EVENT_USB_CABLE_OUT
309 NULL, // EVENT_USB_CABLE_OUT
310 event_card_change, // EVENT_CARD_CHANGE
311 event_long_button, // EVENT_LONG_BUTTON
312 event_short_button, // EVENT_SHORT_BUTTON
313 event_button_release, // EVENT_BUTTON_RELEASE
314 event_dsp_exception, // EVENT_DSP_EXCEPTION
315 };
316
317 void user_main(UINT8 event, UINT8 argv)
318 {
319 1 event_argv = argv;
320 1 event -= 0x80;
321 1
322 1 if(handlers[event])
323 1 (*handlers[event])();
324 1 }
325
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 506 ----
CONSTANT SIZE = 92 ----
XDATA SIZE = 5 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -