万年历源码

已有 445042个资源

下载专区

文档信息举报收藏

标    签:万年历源码

分    享:

文档简介

万年历源码万年历源码万年历源码

文档预览

#define Null 0 void NullSubs(void) { } code struct MenuItem MainMenu[7]; code struct MenuItem testMenu[6]; #define LcdMaxLine 2 struct MenuItem (*MenuPoint) = MainMenu; unsigned char DisplayStart=0; unsigned char UserChoose=0; unsigned char DisplayPoint=0; unsigned char MaxItems=0; bit ShowMenuFlag=0; struct MenuItem { unsigned char MenuCount; unsigned char *DisplayString; void (*Subs)(); struct MenuItem *ChildrenMenus; struct MenuItem *ParentMenus; }; code struct MenuItem MainMenu[7] = { {7,"Set Time ",NullSubs,testMenu,Null}, {7,"Set Alarm Time",NullSubs,Null,Null}, {7,"Alarm Swtich ",NullSubs,Null,Null}, {7,"Check Alarm ",NullSubs,Null,Null}, {7,"Alarm Init ",NullSubs,Null,Null}, {7,"Exit ",NullSubs,MainMenu,MainMenu}, {7,"test ",NullSubs,MainMenu,MainMenu} }; code struct MenuItem testMenu[6] = { {6,"matisha.lofter.com/",NullSubs,Null,MainMenu}, {6,"22222222222222",NullSubs,Null,MainMenu}, {6,"33333333333333",NullSubs,Null,MainMenu}, {6,"44444444444444",NullSubs,Null,MainMenu}, {6,"55555555555555",NullSubs,Null,MainMenu}, {6,"matisha.lofter.com/",NullSubs,Null,MainMenu} }; void ShowMenu(void) { unsigned char i = 0; MaxItems = MenuPoint[0].MenuCount; DisplayPoint = DisplayStart; for(i=0;i"); else LCD_Write_String(0,i," "); LCD_Write_String(2,i,MenuPoint[DisplayPoint++].DisplayString); }else { LCD_Write_String(2,LcdMaxLine-1," "); } } if(UserChoose%LcdMaxLine==0){ DisplayStart = UserChoose; }else{ for(i=0;i<=MaxItems;i++){ if(UserChoose!=(i%LcdMaxLine)) DisplayStart = UserChoose-1; } } } void ChangeMenu(unsigned char keynum) { switch(keynum){ case ADD: UserChoose--; if (UserChoose==255) { UserChoose = 0; } break; case SUB: UserChoose++; if (UserChoose == MaxItems) { UserChoose = MaxItems-1; } break; case ENTER: if (MenuPoint[UserChoose].Subs != NullSubs) { (*MenuPoint[UserChoose].Subs)(); } else if (MenuPoint[UserChoose].ChildrenMenus != Null) { MenuPoint = MenuPoint[UserChoose].ChildrenMenus; UserChoose = 0; DisplayStart = 0; } break; case SET: if (MenuPoint[UserChoose].ParentMenus != Null) { MenuPoint = MenuPoint[UserChoose].ParentMenus; UserChoose = 0; DisplayStart = 0; } break; default:break; } ShowMenu(); }

Top_arrow
回到顶部
EEWORLD下载中心所有资源均来自网友分享,如有侵权,请发送举报邮件到客服邮箱bbs_service@eeworld.com.cn 或通过站内短信息或QQ:273568022联系管理员 高员外,我们会尽快处理。