#pragma once #include // #include #include "AccelStepper.h" class Atm_stepper: public Machine { public: enum { IDLE, READY, RUNNING, STOPPING }; // STATES enum { EVT_IDLE_TIMER, EVT_ON_TARGET, EVT_GOTO, ELSE }; // EVENTS Atm_stepper( void ) : Machine() {}; Atm_stepper& begin( int setpPin, int dirPin ) ; Atm_stepper& trace( Stream & stream ); Atm_stepper& trigger( int event ); int state( void ); Atm_stepper& onOnchange( Machine& machine, int event = 0 ); Atm_stepper& onOnchange( atm_cb_push_t callback, int idx = 0 ); Atm_stepper& gotoStep( long int targetStep ); private: AccelStepper _motor; // Stepper *_motor; // STEP pin: 2, DIR pin: 3 // StepControl _controller; enum { ENT_IDLE, ENT_READY, ENT_RUNNING, LP_RUNNING, ENT_STOPPING, EXT_STOPPING }; // ACTIONS enum { ON_ONCHANGE, CONN_MAX }; // CONNECTORS atm_connector connectors[CONN_MAX]; int event( int id ); void action( int id ); }; /* Automaton::ATML::begin - Automaton Markup Language RUNNING IDLE RUNNING STOPPING RUNNING READY Automaton::ATML::end */