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