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