📄 user_main.lst
字号:
163 2 }
164 1 }
165
166 void event_usb_status_change(void)
167 {
168 1 }
169
170 void event_init_startup(void);
171 void event_usb_cable_out(void)
172 {
173 1
174 1 }
175
176 void event_usb_cable_in(void)
C51 COMPILER V7.50 USER_MAIN 08/18/2008 13:49:25 PAGE 4
177 {
178 1 api_vLoad(Code_USER13,1);
179 1 }
180
181 void event_quarter_sec(void)
182 {
183 1 if(curr_screen->id == SCREEN_TXT && tUserPreference.r_mode == 1)
184 1 {
185 2 if((txt_count++>=tUserPreference.r_speed*4) && (eSysState == STATE_IDLE))
186 2 {
187 3 key_process(KEY(NEXT));
188 3 txt_count = 0;
189 3 }
190 2 }
191 1
192 1 #if 0
if(screen_level!=SCREEN_LEVEL_USB_ON)
{
if(usb_plug)
{
ui_show_charge1();
}
}
else
{
ui_show_charge();
}
#endif
205 1
206 1 if(batt_count++ > 6 )
207 1 {
208 2 batt_count = 0;
209 2 //if(!usb_plug)
210 2 // ui_show_batt();
211 2 }
212 1 if(api_u8GetBatteryRemain() <= BATTERY_LEVEL_20)
213 1 {
214 2 low_batt_count++;
215 2 }
216 1 else
217 1 {
218 2 low_batt_count = 0;
219 2 }
220 1 if(low_batt_count==6) //shut down
221 1 {
222 2 //close_volume();
223 2 bResShowPic(LOWPOWER,0,0);
224 2 delay(10000);
225 2 delay(10000);
226 2 vShutDown();
227 2 }
228 1 vKeyTimeOut();
229 1 }
230
231 void event_dsp_exception(void)
232 {
233 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));
C51 COMPILER V7.50 USER_MAIN 08/18/2008 13:49:25 PAGE 5
}
#endif
241 1 }
242
243 void event_loop_epilog(void)
244 {
245 1 }
246
247 void event_init_startup(void)
248 {
249 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
259 1 api_vKeyMapRegister(key_map);
260 1 api_vSetPassCount(30);
261 1 api_vBatteryLevelRegister(battery_map);
262 1 api_bLoadPreferenceData((void*)(&tUserPreference),sizeof(USER_PREFERENCE_T));
263 1
264 1 if (tUserPreference.u8magic != 0xa5)
265 1 {
266 2 vPreferenceDataInit();
267 2 tUserPreference.u8LanguageId =0;
268 2 api_bSavePreferenceData(&tUserPreference,sizeof(USER_PREFERENCE_T));
269 2 }
270 1
271 1
272 1 if(tUserPreference.u8LanguageId>4)
273 1 api_bSetLanguage(0);
274 1 else
275 1 api_bSetLanguage(tUserPreference.u8LanguageId);
276 1 if(api_bChangeDisk(DISK_SD))
277 1 have_sd = 1;
278 1 else
279 1 have_sd = 0;
280 1
281 1 api_bChangeDisk(DISK_NAND);
282 1 u16TimerCount = 0;
283 1 txt_init = 1;
284 1 //lcd_init();
285 1 gui_init();
286 1
287 1 screen_map(SCREEN_TXT);
288 1 }
289
290
291 typedef void event_handler(void);
292
293 static code event_handler *handlers[] = {
294 event_init_startup, // EVENT_INIT_STARTUP
295 NULL, // EVENT_WATCHDOG_UP
296 NULL, // EVENT_LOOP_PROLOG
297 event_loop_epilog, // EVENT_LOOP_EPILOG
298 NULL, // EVENT_OCTANT_SEC
299 event_quarter_sec, // EVENT_QUARTER_SEC
300 event_usb_cable_in, // EVENT_USB_CABLE_IN
C51 COMPILER V7.50 USER_MAIN 08/18/2008 13:49:25 PAGE 6
301 event_usb_cable_out, // EVENT_USB_CABLE_OUT
302 event_usb_status_change, // EVENT_USB_STATUS_CHANGE
303 event_card_change, // EVENT_CARD_CHANGE
304 event_long_button, // EVENT_LONG_BUTTON
305 event_short_button, // EVENT_SHORT_BUTTON
306 event_button_release, // EVENT_BUTTON_RELEASE
307 event_dsp_exception, // EVENT_DSP_EXCEPTION
308 };
309
310 void user_main(UINT8 event, UINT8 argv)
311 {
312 1 event_argv = argv;
313 1 event -= 0x80;
314 1
315 1 if(handlers[event])
316 1 (*handlers[event])();
317 1 }
318
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 494 ----
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 + -