今天上午還是繼續(xù)學(xué)習(xí)項(xiàng)目中的。按鍵中斷部分,通過按鍵,進(jìn)去不同的事件。再通過switch case在不用狀態(tài)下響應(yīng)不同的時(shí)間
事件發(fā)生時(shí),執(zhí)行的函數(shù)
void e0_event_function(int * nxt_state)
{?
? ? int cur_state;?
? ? cur_state = *nxt_state;?
? ? switch(cur_state)
? ? {? ? ?
? ? ? ? case s0: //觀察表1,在e0事件發(fā)生時(shí),s1處為空?
? ? ? ? case s2: //執(zhí)行a0動(dòng)作;? ? ? ? ?
? ? ? ? *nxt_state = s0;
? ? }
}
//e1事件發(fā)生時(shí),執(zhí)行的函數(shù)
void e1_event_function(int * nxt_state)
{?
? ? int cur_state;?
? ? cur_state = *nxt_state;?
? ? switch(cur_state)
? ? {? ? ?
? ? ? ? case s0: //觀察表1,在e1事件發(fā)生時(shí),s1和s2處為空? ? ? ? ?
? ? ? ? ? ? //執(zhí)行a1動(dòng)作;? ? ? ? ?
? ? ? ? ? ? *nxt_state = s1;
? ? }
}
//e2事件發(fā)生時(shí),執(zhí)行的函數(shù)
void e2_event_function(int * nxt_state)
{?
? ? int cur_state;?
? ? cur_state = *nxt_state;?
? ? switch(cur_state)
? ? {? ? ?
? ? ? ? case s0: //觀察表1,在e2事件發(fā)生時(shí),s2處為空? ? ?
? ? ?
? ? ? 下午進(jìn)行了搖桿的學(xué)習(xí),自己學(xué)習(xí)了搖桿得部分,但是不太明白具體怎么控制要實(shí)現(xiàn)什么,明天繼續(xù)學(xué)習(xí)