Module: remove unused kernel pointer, shrink every Module instance by 4 bytes
[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
10#include "libs/Module.h"
11#include "libs/Kernel.h"
12#include "Planner.h"
13#include "Block.h"
14
d4f93cf4
AG
15#define microseconds_per_step_pulse_checksum CHECKSUM("microseconds_per_step_pulse")
16#define acceleration_ticks_per_second_checksum CHECKSUM("acceleration_ticks_per_second")
17#define minimum_steps_per_minute_checksum CHECKSUM("minimum_steps_per_minute")
18#define base_stepping_frequency_checksum CHECKSUM("base_stepping_frequency")
4cff3ded
AW
19
20class Stepper : public Module {
21 public:
22 Stepper();
23 void on_module_loaded();
da24d6ae 24 void on_config_reload(void* argument);
3a4fa0c1
AW
25 void on_block_begin(void* argument);
26 void on_block_end(void* argument);
31e600f6 27 void on_gcode_received(void* argument);
15908331 28 void on_gcode_execute(void* argument);
befcf5cc
AW
29 void on_play(void* argument);
30 void on_pause(void* argument);
8b8b3339 31 uint32_t main_interrupt(uint32_t dummy);
4cff3ded 32 void trapezoid_generator_reset();
da947c62 33 void set_step_events_per_second(float);
8b8b3339 34 uint32_t trapezoid_generator_tick(uint32_t dummy);
feb204be 35 uint32_t stepper_motor_finished_move(uint32_t dummy);
4cff3ded 36 int config_step_timer( int cycles );
831bade1
AW
37 void turn_enable_pins_on();
38 void turn_enable_pins_off();
2f7d3dba 39 uint32_t synchronize_acceleration(uint32_t dummy);
3a4fa0c1 40
4cff3ded 41 Block* current_block;
4cff3ded 42 int counters[3];
df27a6a3
MM
43 int stepped[3];
44 int offsets[3];
4cff3ded
AW
45 float counter_alpha;
46 float counter_beta;
47 float counter_gamma;
df27a6a3
MM
48 //int step_events_completed;
49 unsigned int out_bits;
1ad23cd3 50 float trapezoid_adjusted_rate;
4cff3ded 51 int trapezoid_tick_cycle_counter;
df27a6a3 52 int cycles_per_step_event;
4cff3ded 53 bool trapezoid_generator_busy;
df27a6a3 54 int microseconds_per_step_pulse;
4cff3ded 55 int acceleration_ticks_per_second;
da947c62 56 unsigned int minimum_steps_per_second;
4cff3ded 57 int base_stepping_frequency;
a2cd92c0
AW
58 unsigned short step_bits[3];
59 int counter_increment;
81b547a1 60 bool paused;
1013f6a3 61 bool force_speed_update;
831bade1 62 bool enable_pins_status;
2f7d3dba 63 Hook* acceleration_tick_hook;
feb204be 64
670fa10b 65 StepperMotor* main_stepper;
feb204be 66
4cff3ded
AW
67};
68
69
70
71
72#endif