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/>.
23 static StepTicker
* global_step_ticker
;
27 void set_frequency( float frequency
);
28 void signal_a_move_finished();
29 void set_reset_delay( float seconds
);
30 int register_motor(StepperMotor
* motor
);
31 void add_motor_to_active_list(StepperMotor
* motor
);
32 void remove_motor_from_active_list(StepperMotor
* motor
);
33 void set_acceleration_ticks_per_second(uint32_t acceleration_ticks_per_second
);
34 float get_frequency() const { return frequency
; }
36 uint32_t get_tick_cnt() const { return tick_cnt
; }
37 uint32_t ticks_since(uint32_t last
) const { return (tick_cnt
>=last
) ? tick_cnt
-last
: (UINT32_MAX
-last
) + tick_cnt
+ 1; }
39 void TIMER0_IRQHandler (void);
40 void PendSV_IRQHandler (void);
41 void register_acceleration_tick_handler(std::function
<void(void)> cb
){
42 acceleration_tick_handlers
.push_back(cb
);
44 void acceleration_tick();
45 void synchronize_acceleration(bool fire_now
);
49 friend class StepperMotor
;
54 volatile uint32_t tick_cnt
;
55 std::vector
<std::function
<void(void)>> acceleration_tick_handlers
;
56 std::vector
<StepperMotor
*> motor
;
57 std::bitset
<32> active_motor
; // limit to 32 motors
58 std::bitset
<32> unstep
; // limit to 32 motors
59 std::atomic_uchar do_move_finished
;
61 volatile bool a_move_finished
;