單片機(jī)c語言中菜單系統(tǒng)源碼分析
int main()
{
typedef struct
{
u8 KeyCurrentIndex;//當(dāng)前狀態(tài)索引號
u8 KeyEnterState;//按下【enter】鍵時轉(zhuǎn)向的索引號
u8 KeyCancelState;//按下【cancel】鍵時轉(zhuǎn)向的索引號
u8 KeyUpState;//按下【up】鍵時轉(zhuǎn)向的索引號
u8 KeyDownState;//按下【down】鍵時轉(zhuǎn)向的索引號
void (*CurrentOperate)(); //當(dāng)前狀態(tài)下執(zhí)行的功能操作
}KbdTabStruct;
const KbdTabStruct KBD[]=
{
{0,1,2,3,4,(*main)},
{6,7,8,9,10,(*main)},
{0,1,2,3,4,,(*main)},
{0,1,2,3,4,(*main)},
};
printf("%d",KBD[0].KeyCurrentIndex);
printf("%d",KBD[0].KeyEnterState);
printf("%d",KBD[0].KeyCancelState);
printf("%d",KBD[0].KeyUpState);
printf("%d",KBD[0].KeyDownState);
printf("%d",KBD[1].KeyCurrentIndex);
printf("%d",KBD[1].KeyEnterState);
printf("%d",KBD[1].KeyCancelState);
printf("%d",KBD[1].KeyUpState);
printf("%d",KBD[1].KeyDownState);
printf("%5s",KBD[0].CurrentOperate);
}
評論