📄 user_main.lst
字号:
173 void event_usb_cable_in(void)
174 {
175 1 //usb_online();
176 1 //screen_map(SCREEN_USB);
C51 COMPILER V7.50 USER_MAIN 08/18/2008 14:21:06 PAGE 4
177 1 api_vLoad(Code_USER13,1);
178 1 }
179
180 void event_quarter_sec(void)
181 {
182 1 // UINT16 data ptime;
183 1
184 1 if(curr_screen->id == SCREEN_REC && screen_level == SCREEN_LEVEL_REC_START)
185 1 play_time_update();
186 1
187 1 //if(curr_screen->id == SCREEN_REC && screen_level == SCREEN_LEVEL_REC_START) {
188 1 // if(qtime_ticks++ >= 20) {
189 1 // api_bRecordSync();
190 1 // qtime_ticks = 0;
191 1 // } //
192 1 //}
193 1 if(screen_level!=SCREEN_LEVEL_USB_ON)
194 1 {
195 2 if(usb_plug)
196 2 {
197 3 ui_show_charge1();
198 3 }
199 2 }
200 1 else
201 1 {
202 2 ui_show_charge();
203 2 }
204 1
205 1 if(batt_count++ > 6 )
206 1 {
207 2 batt_count = 0;
208 2 if(!usb_plug)
209 2 ui_show_batt();
210 2 }
211 1 if(api_u8GetBatteryRemain() <= BATTERY_LEVEL_20)
212 1 {
213 2 low_batt_count++;
214 2 }
215 1 else
216 1 {
217 2 low_batt_count = 0;
218 2 }
219 1 if(low_batt_count==6) //shut down
220 1 {
221 2 close_volume();
222 2 ui_show_message(RSAVING);
223 2 bResShowPic(LOWPOWER,0,0);
224 2 delay(10000);
225 2 delay(10000);
226 2 vShutDown();
227 2 }
228 1
229 1 vKeyTimeOut();
230 1 }
231
232 void event_dsp_exception(void)
233 {
234 1
235 1 }
236
237 void event_loop_epilog(void)
238 {
C51 COMPILER V7.50 USER_MAIN 08/18/2008 14:21:06 PAGE 5
239 1 #if 1
240 1 if(curr_screen->id == SCREEN_REC && music_on) {
241 2 if(eSysState == STATE_IDLE) {
242 3 key_process(KEY(EOS));
243 3 music_on = 0;
244 3 }
245 2 }
246 1 #if 0
else if(music_on) {
if(curr_screen->id == SCREEN_MAINMENU || curr_screen->id == SCREEN_FILEBROWSER)
if(eSysState == STATE_IDLE)
key_process(KEY(EOS));
}
#endif
253 1
254 1 #endif
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(30);
271 1 api_vBatteryLevelRegister(battery_map);
272 1 api_bLoadPreferenceData((void*)(&tUserPreference),sizeof(USER_PREFERENCE_T));
273 1
274 1 #if 1
275 1 if (tUserPreference.u8magic != 0xa5)
276 1 {
277 2 vPreferenceDataInit();
278 2 tUserPreference.u8LanguageId =0;
279 2 api_bSavePreferenceData(&tUserPreference,sizeof(USER_PREFERENCE_T));
280 2 }
281 1 #endif
282 1
283 1 if(tUserPreference.u8LanguageId>4 || tUserPreference.u8LanguageId == 0)
284 1 api_bSetLanguage(0);
285 1 else
286 1 api_bSetLanguage(tUserPreference.u8LanguageId);
287 1
288 1 if(api_bChangeDisk(DISK_SD))
289 1 have_sd = 1;
290 1 else
291 1 have_sd = 0;
292 1
293 1 api_bChangeDisk(DISK_NAND);
294 1 u16TimerCount = 0;
295 1 //api_bRecordInit("RECORD",32768);
296 1 // return;
297 1 music_on = 0;
298 1 lcd_init();
299 1 gui_init();
300 1 screen_level = SCREEN_LEVEL_MUSIC_STOP;
C51 COMPILER V7.50 USER_MAIN 08/18/2008 14:21:06 PAGE 6
301 1 //bResShowPic(1,0,0);
302 1 //api_bSetLanguage(0);
303 1 //tUserPreference.u8LanguageId=0;
304 1 //close_volume();
305 1 api_bRecordStop();
306 1 api_bStop();
307 1 close_volume();
308 1 screen_map(SCREEN_REC);
309 1 }
310
311
312 typedef void event_handler(void);
313
314 static code event_handler *handlers[] = {
315 event_init_startup, // EVENT_INIT_STARTUP
316 NULL, // EVENT_WATCHDOG_UP
317 NULL, // EVENT_LOOP_PROLOG
318 event_loop_epilog, // EVENT_LOOP_EPILOG
319 NULL, // EVENT_OCTANT_SEC
320 event_quarter_sec, // EVENT_QUARTER_SEC
321 event_usb_cable_in, // EVENT_USB_CABLE_IN
322 event_usb_cable_out, // EVENT_USB_CABLE_OUT
323 event_usb_status_change, // EVENT_USB_STATUS_CHANGE
324 event_card_change, // EVENT_CARD_CHANGE
325 event_long_button, // EVENT_LONG_BUTTON
326 event_short_button, // EVENT_SHORT_BUTTON
327 event_button_release, // EVENT_BUTTON_RELEASE
328 event_dsp_exception, // EVENT_DSP_EXCEPTION
329 };
330
331 void user_main(UINT8 event, UINT8 argv)
332 {
333 1 event_argv = argv;
334 1 event -= 0x80;
335 1
336 1 if(handlers[event])
337 1 (*handlers[event])();
338 1 }
339
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 541 ----
CONSTANT SIZE = 92 ----
XDATA SIZE = 4 ----
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 + -