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/>.
18 #include "ActuatorCoordinates.h"
19 #include "TSRingBuffer.h"
24 // handle 2.30 Fixed point
25 #define STEPTICKER_FPSCALE (1<<30)
26 #define STEPTICKER_TOFP(x) ((int32_t)roundf((float)(x)*STEPTICKER_FPSCALE))
27 #define STEPTICKER_FROMFP(x) ((float)(x)/STEPTICKER_FPSCALE)
33 void set_frequency( float frequency
);
34 void set_unstep_time( float microseconds
);
35 int register_motor(StepperMotor
* motor
);
36 float get_frequency() const { return frequency
; }
38 const Block
*get_current_block() const { return current_block
; }
40 void step_tick (void);
41 void handle_finish (void);
44 // whatever setup the block should register this to know when it is done
45 std::function
<void()> finished_fnc
{nullptr};
47 static StepTicker
*getInstance() { return instance
; }
50 static StepTicker
*instance
;
52 bool start_next_block();
56 std::array
<StepperMotor
*, k_max_actuators
> motor
;
57 std::bitset
<k_max_actuators
> unstep
;
60 uint32_t current_tick
{0};
63 volatile bool running
:1;