commit

Dependencies:   MPU6050_SIM5320_TEST

Fork of MPU_SDCARD by Suad Suljic

Revision:
1:75966605a6a3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MotionFSM/include/Fsm.h	Fri Nov 10 15:35:26 2017 +0000
@@ -0,0 +1,48 @@
+#ifndef MOTIONFSM_FSM_H_
+#define MOTIONFSM_FSM_H_
+#include <State.h>
+#include "mbed.h"
+
+#include <Events.h>
+
+struct Stop;
+struct Move;
+
+class FsmStates {
+  public:
+  FsmStates();
+  
+  State* movingState();
+  State* stacionaryState();
+  State* currentState();
+  
+  void currentState(State* state);
+
+  ~FsmStates();
+
+  private:
+  
+  State* movingState_;
+  State* stacionaryState_;
+  State* currentState_;
+  
+  Timer timer;
+  
+};
+
+class Fsm {
+  public:
+  Fsm();
+  template <typename Event> 
+  void handle(Event& event){
+    State* state = states_.currentState()->handle(event);
+    states_.currentState(state);
+  }
+  
+  virtual ~Fsm() {}
+  FsmStates states_;
+  private:
+  
+
+};
+#endif /* ifndef MOTIONFSM_FSM_H_ */