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.
FSM.h
00001 #include "LinkedList.h" 00002 00003 class Transition 00004 { 00005 public: 00006 Transition(){} 00007 Transition(int from, int to): _from(from), _to(to) {} 00008 private: 00009 int _from; 00010 int _to; 00011 }; 00012 class FSM 00013 { 00014 public: 00015 FSM(size_t num_state); 00016 ~FSM(); 00017 void setInitialState(unsigned int uid); 00018 void addState(unsigned int uid,unsigned int (*state)(void)); 00019 void addTransition(int from, int to); 00020 void execute(); 00021 00022 //attributes 00023 private: 00024 00025 //attributes 00026 struct MachineState { 00027 unsigned int uid; 00028 unsigned int (*state)(void); 00029 }MachineState; 00030 unsigned int _uid_zero; 00031 unsigned int _cur_state; 00032 struct MachineState *states; // Arrays that store states; 00033 LinkedList<node> trans; 00034 size_t _num_state; 00035 size_t _index_state; 00036 00037 };
Generated on Wed Aug 17 2022 05:29:14 by
1.7.2