#pragma once #include #include // #include class Atm_TeensyStep: public Machine { public: enum { IDLE, READY, RUNNING, STOPPING }; // STATES enum { EVT_IDLE_TIMER, EVT_ON_TARGET, EVT_GOTO, ELSE }; // EVENTS Atm_TeensyStep( void ) : Machine() {}; Atm_TeensyStep& begin( Stepper & motorRef , StepControl & stepControlRef ) ; Atm_TeensyStep& trace( Stream & stream ); Atm_TeensyStep& trigger( int event ); int state( void ); Atm_TeensyStep& onOnchange( Machine& machine, int event = 0 ); Atm_TeensyStep& onOnchange( atm_cb_push_t callback, int idx = 0 ); Atm_TeensyStep& move( long int stepRel ); Atm_TeensyStep& moveTo( long int stepAbs ); Atm_TeensyStep& stop(); Stepper * motor; StepControl * controller; 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 ); long int _currentStep ; long int _targetStep ; }; /* Automaton::ATML::begin - Automaton Markup Language RUNNING IDLE RUNNING STOPPING RUNNING READY Automaton::ATML::end */