7 // events of each state of state machine
16 typedef void (*state_fcn)(struct fsm *fsm, enum event my_event);//pointer to function returning void and two input parametr
19 state_fcn current_state; // current state
20 state_fcn last_state; // last state
21 int32_t act_pos; // actual position
22 int32_t req_pos; // requested position
25 volatile int32_t can_req_spd;
26 volatile uint32_t can_req_position; // next requested position
28 uint32_t can_response; // when the move is done, the value here equals to the req_pos
29 uint8_t flags; //< CAN flags bits (defined in can_msg_def.h)
30 uint32_t time_start; /* For timeout detection */
31 bool trigger_can_send;
32 uint8_t can_req_homing;
36 void init_fsm(struct fsm *fsm, state_fcn initial_state);
37 void run_fsm(struct fsm *fsm);