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" |
5673fe39 MM |
12 | |
13 | class Block; | |
14 | class Hook; | |
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); | |
27 | void on_play(void *argument); | |
28 | void on_pause(void *argument); | |
29 | uint32_t main_interrupt(uint32_t dummy); | |
30 | void trapezoid_generator_reset(); | |
31 | void set_step_events_per_second(float); | |
32 | uint32_t trapezoid_generator_tick(uint32_t dummy); | |
33 | uint32_t stepper_motor_finished_move(uint32_t dummy); | |
34 | int config_step_timer( int cycles ); | |
35 | void turn_enable_pins_on(); | |
36 | void turn_enable_pins_off(); | |
37 | uint32_t synchronize_acceleration(uint32_t dummy); | |
4cff3ded | 38 | |
38bf9a1c JM |
39 | int get_acceleration_ticks_per_second() const { return acceleration_ticks_per_second; } |
40 | unsigned int get_minimum_steps_per_second() const { return minimum_steps_per_second; } | |
41 | float get_trapezoid_adjusted_rate() const { return trapezoid_adjusted_rate; } | |
42 | const Block *get_current_block() const { return current_block; } | |
3a4fa0c1 | 43 | |
38bf9a1c JM |
44 | private: |
45 | Block *current_block; | |
46 | int counters[3]; | |
47 | int stepped[3]; | |
48 | int offsets[3]; | |
49 | float counter_alpha; | |
50 | float counter_beta; | |
51 | float counter_gamma; | |
52 | unsigned int out_bits; | |
53 | float trapezoid_adjusted_rate; | |
54 | int trapezoid_tick_cycle_counter; | |
55 | int cycles_per_step_event; | |
56 | bool trapezoid_generator_busy; | |
57 | int microseconds_per_step_pulse; | |
58 | int acceleration_ticks_per_second; | |
59 | unsigned int minimum_steps_per_second; | |
60 | int base_stepping_frequency; | |
61 | unsigned short step_bits[3]; | |
62 | int counter_increment; | |
63 | bool paused; | |
64 | bool force_speed_update; | |
65 | bool enable_pins_status; | |
66 | Hook *acceleration_tick_hook; | |
feb204be | 67 | |
38bf9a1c | 68 | StepperMotor *main_stepper; |
feb204be | 69 | |
4cff3ded AW |
70 | }; |
71 | ||
72 | ||
73 | ||
74 | ||
75 | #endif |