comments - this seems to work
[clinton/Smoothieware.git] / src / modules / robot / Stepper.h
CommitLineData
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
14class Block;
15class Hook;
16class StepperMotor;
4cff3ded 17
38bf9a1c
JM
18class Stepper : public Module
19{
20public:
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 41 int get_acceleration_ticks_per_second() const { return acceleration_ticks_per_second; }
38bf9a1c
JM
42 float get_trapezoid_adjusted_rate() const { return trapezoid_adjusted_rate; }
43 const Block *get_current_block() const { return current_block; }
3a4fa0c1 44
38bf9a1c
JM
45private:
46 Block *current_block;
38bf9a1c 47 int stepped[3];
38bf9a1c 48 float trapezoid_adjusted_rate;
38bf9a1c 49 int acceleration_ticks_per_second;
38bf9a1c 50 Hook *acceleration_tick_hook;
38bf9a1c 51 StepperMotor *main_stepper;
feb204be 52
728477c4
JM
53 struct {
54 bool enable_pins_status:1;
55 bool force_speed_update:1;
56 bool paused:1;
57 bool trapezoid_generator_busy:1;
58 bool halted:1;
59 };
60
4cff3ded
AW
61};
62
63
64
65
66#endif