Commit | Line | Data |
---|---|---|
df27a6a3 | 1 | /* |
4cff3ded AW |
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. | |
df27a6a3 | 5 | You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. |
4cff3ded AW |
6 | */ |
7 | ||
8 | #ifndef STEPPER_H | |
9 | #define STEPPER_H | |
5673fe39 | 10 | |
4cff3ded | 11 | #include "libs/Module.h" |
e0d0ea84 | 12 | #include <stdint.h> |
5673fe39 MM |
13 | |
14 | class Block; | |
5673fe39 | 15 | class StepperMotor; |
4cff3ded | 16 | |
38bf9a1c JM |
17 | class Stepper : public Module |
18 | { | |
19 | public: | |
20 | Stepper(); | |
21 | void on_module_loaded(); | |
22 | void on_config_reload(void *argument); | |
23 | void on_block_begin(void *argument); | |
24 | void on_block_end(void *argument); | |
25 | void on_gcode_received(void *argument); | |
26 | void on_gcode_execute(void *argument); | |
3d1a4519 | 27 | void on_halt(void *argument); |
798295c1 | 28 | |
38bf9a1c JM |
29 | void trapezoid_generator_reset(); |
30 | void set_step_events_per_second(float); | |
a157d099 | 31 | void trapezoid_generator_tick(void); |
38bf9a1c JM |
32 | uint32_t stepper_motor_finished_move(uint32_t dummy); |
33 | int config_step_timer( int cycles ); | |
34 | void turn_enable_pins_on(); | |
35 | void turn_enable_pins_off(); | |
4cff3ded | 36 | |
38bf9a1c JM |
37 | float get_trapezoid_adjusted_rate() const { return trapezoid_adjusted_rate; } |
38 | const Block *get_current_block() const { return current_block; } | |
3a4fa0c1 | 39 | |
38bf9a1c JM |
40 | private: |
41 | Block *current_block; | |
38bf9a1c | 42 | float trapezoid_adjusted_rate; |
38bf9a1c | 43 | StepperMotor *main_stepper; |
feb204be | 44 | |
728477c4 JM |
45 | struct { |
46 | bool enable_pins_status:1; | |
47 | bool force_speed_update:1; | |
728477c4 JM |
48 | bool halted:1; |
49 | }; | |
50 | ||
4cff3ded AW |
51 | }; |
52 | ||
53 | ||
54 | ||
55 | ||
56 | #endif |