2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4 Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
11 #include "libs/Kernel.h"
12 #include "libs/Hook.h"
13 #include "libs/actuators/Actuator.h"
17 class StepperMotor
: public Actuator
{
20 StepperMotor(Pin
* step
, Pin
* dir
, Pin
* en
);
25 void move( bool direction
, unsigned int steps
);
26 void signal_move_finished();
27 void set_speed( double speed
);
28 void update_exit_tick();
32 StepTicker
* step_ticker
;
37 bool is_move_finished
; // Whether the move just finished
41 // Called a great many times per second, to step if we have to now
42 inline void StepperMotor::tick(){
44 // increase the ( fixed point ) counter by one tick 11t
45 this->fx_counter
+= (uint32_t)(1<<16);
47 // if we are to step now 10t
48 if( this->fx_counter
>= this->fx_ticks_per_step
){ this->step(); }