jonblack/arduino-fsm

call back objects support

Opened this issue · 0 comments

  1. currently, fsm can work only with free call back functions:
struct State {
  State(void (*on_enter)(), void (*on_state)(), void (*on_exit)());
  void (*on_enter)();
  void (*on_state)();
  void (*on_exit)();
};
  1. this makes fsm non-composable with objects, lambdas, etc.

  2. please add support for call back objects instead:

struct State {
  virtual void on_enter() = 0;
  virtual void on_state() = 0;
  virtual void on_exit() = 0;
};
  1. same also applies to transitions
  struct Transition
  {
    State* state_from;
    State* state_to;
    int event;
    void (*on_transition)();

  };