Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MPU6050_SIM5320_TEST
Fork of MPU_SDCARD by
Fsm.h
00001 #ifndef MOTIONFSM_FSM_H_ 00002 #define MOTIONFSM_FSM_H_ 00003 #include <State.h> 00004 #include "mbed.h" 00005 00006 #include <Events.h> 00007 00008 struct Stop; 00009 struct Move; 00010 00011 class FsmStates { 00012 public: 00013 FsmStates(); 00014 00015 State* movingState(); 00016 State* stacionaryState(); 00017 State* currentState(); 00018 00019 void currentState(State* state); 00020 00021 ~FsmStates(); 00022 00023 private: 00024 00025 State* movingState_; 00026 State* stacionaryState_; 00027 State* currentState_; 00028 00029 Timer timer; 00030 00031 }; 00032 00033 class Fsm { 00034 public: 00035 Fsm(); 00036 template <typename Event> 00037 void handle(Event& event){ 00038 State* state = states_.currentState()->handle(event); 00039 states_.currentState(state); 00040 } 00041 00042 virtual ~Fsm() {} 00043 FsmStates states_; 00044 private: 00045 00046 00047 }; 00048 #endif /* ifndef MOTIONFSM_FSM_H_ */
Generated on Tue Jul 12 2022 19:25:17 by
1.7.2
