//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Automatic generated C-code by the application:
// HFSM Editor v1.4r3
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Methodology: Hierarchical Switch-case state. [v1.5r1]
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Exported function: void FSM_0001(void);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Initialization proposed by the user (Start).
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
key == left
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Initialization proposed by the user (End).
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Entry flags (Start).
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Entry flags (End).
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Automatic initialization (Start).
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// States index.
#define i_STATE_1 ((T_u8)0)
#define i_STATE_2 ((T_u8)1)
#define i_STATE_21 ((T_u8)2)
#define i_STATE_22 ((T_u8)3)
#define i_STATE_3 ((T_u8)4)
#define i_STATE_31 ((T_u8)5)
#define i_STATE_32 ((T_u8)6)
// Index variable.
static T_u8 ind_FSM_0001 = i_STATE_1;
// Macros & functions.
// Force the FSM to the initial state.
#define FSM_0001_Init() { ind_FSM_0001 = i_STATE_1; }
// This is not a history FSM.
#define _FSM_0001_Init() {FSM_0001_Init(); /* Children: */ }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Automatic initialization (End).
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Local child functions (Start).
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Local child functions (End).
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// FSM dispatcher function to be called by the O.S.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void FSM_0001(void)
{
// Next state analyser.
switch(ind_FSM_0001){
case i_STATE_1:
// State actions (Moore).
WriteLCD("Welcome!");
// Next state selection.
if(key == down){
// Pointing to the next state.
ind_FSM_0001 = i_STATE_2;
}
break;
case i_STATE_2:
// State actions (Moore).
WriteLCD("Menu1");
// Next state selection.
if(key == up){ // [1].
// Pointing to the next state.
ind_FSM_0001 = i_STATE_1;
}else if(key == right){ // [2].
// Pointing to the next state.
ind_FSM_0001 = i_STATE_21;
}else if(key == down){ // [3].
// Pointing to the next state.
ind_FSM_0001 = i_STATE_3;
}
break;
case i_STATE_21:
// State actions (Moore).
WriteLCD("Submenu 1");
// Next state selection.
if(key == left){ // [1].
// Pointing to the next state.
ind_FSM_0001 = i_STATE_2;
}else if(key == ok){ // [2].
// Pointing to the next state.
ind_FSM_0001 = i_STATE_22;
}
break;
case i_STATE_22:
// State actions (Moore).
ExecuteSubMenu1();
// Next state selection.
{
// Pointing to the next state.
ind_FSM_0001 = i_STATE_1;
}
break;
case i_STATE_3:
// State actions (Moore).
WriteLCD("Menu2");
// Next state selection.
if(key == up){ // [1].
// Pointing to the next state.
ind_FSM_0001 = i_STATE_2;
}else if(key == down){ // [2].
// Pointing to the next state.
ind_FSM_0001 = i_STATE_1;
}else if(key == right){ // [3].
// Pointing to the next state.
ind_FSM_0001 = i_STATE_31;
}
break;
case i_STATE_31:
// State actions (Moore).
WriteLCD("Submenu 2");
// Next state selection.
if(key == left){ // [1].
// Pointing to the next state.
ind_FSM_0001 = i_STATE_3;
}else if(key == ok){ // [2].
// Pointing to the next state.
ind_FSM_0001 = i_STATE_32;
}
break;
case i_STATE_32:
// State actions (Moore).
ExecuteSubmenu2();
// Next state selection.
{
// Pointing to the next state.
ind_FSM_0001 = i_STATE_1;
}
break;
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Ending code proposed by the user (Start).
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Ending code proposed by the user (End).
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// End of the automatic generated C-code.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++