Michael Spencer / Smoothie

Dependencies:   mbed

Fork of Smoothie by Stéphane Cachat

Committer:
Michael J. Spencer
Date:
Fri Feb 28 18:52:52 2014 -0800
Revision:
2:1df0b61d3b5a
Parent:
0:31e91bb0ef3c
Update to latest Smoothie.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Michael J. Spencer 2:1df0b61d3b5a 1 /*
scachat 0:31e91bb0ef3c 2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
scachat 0:31e91bb0ef3c 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.
scachat 0:31e91bb0ef3c 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.
Michael J. Spencer 2:1df0b61d3b5a 5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
scachat 0:31e91bb0ef3c 6 */
scachat 0:31e91bb0ef3c 7
scachat 0:31e91bb0ef3c 8 #ifndef STEPPER_H
scachat 0:31e91bb0ef3c 9 #define STEPPER_H
Michael J. Spencer 2:1df0b61d3b5a 10
scachat 0:31e91bb0ef3c 11 #include "libs/Module.h"
scachat 0:31e91bb0ef3c 12
Michael J. Spencer 2:1df0b61d3b5a 13 class Block;
Michael J. Spencer 2:1df0b61d3b5a 14 class Hook;
Michael J. Spencer 2:1df0b61d3b5a 15 class StepperMotor;
scachat 0:31e91bb0ef3c 16
Michael J. Spencer 2:1df0b61d3b5a 17 #define microseconds_per_step_pulse_checksum CHECKSUM("microseconds_per_step_pulse")
Michael J. Spencer 2:1df0b61d3b5a 18 #define acceleration_ticks_per_second_checksum CHECKSUM("acceleration_ticks_per_second")
Michael J. Spencer 2:1df0b61d3b5a 19 #define minimum_steps_per_minute_checksum CHECKSUM("minimum_steps_per_minute")
Michael J. Spencer 2:1df0b61d3b5a 20 #define base_stepping_frequency_checksum CHECKSUM("base_stepping_frequency")
scachat 0:31e91bb0ef3c 21
scachat 0:31e91bb0ef3c 22 class Stepper : public Module {
scachat 0:31e91bb0ef3c 23 public:
scachat 0:31e91bb0ef3c 24 Stepper();
Michael J. Spencer 2:1df0b61d3b5a 25 void on_module_loaded();
Michael J. Spencer 2:1df0b61d3b5a 26 void on_config_reload(void* argument);
Michael J. Spencer 2:1df0b61d3b5a 27 void on_block_begin(void* argument);
Michael J. Spencer 2:1df0b61d3b5a 28 void on_block_end(void* argument);
Michael J. Spencer 2:1df0b61d3b5a 29 void on_gcode_received(void* argument);
Michael J. Spencer 2:1df0b61d3b5a 30 void on_gcode_execute(void* argument);
Michael J. Spencer 2:1df0b61d3b5a 31 void on_play(void* argument);
Michael J. Spencer 2:1df0b61d3b5a 32 void on_pause(void* argument);
scachat 0:31e91bb0ef3c 33 uint32_t main_interrupt(uint32_t dummy);
scachat 0:31e91bb0ef3c 34 void trapezoid_generator_reset();
Michael J. Spencer 2:1df0b61d3b5a 35 void set_step_events_per_second(float);
scachat 0:31e91bb0ef3c 36 uint32_t trapezoid_generator_tick(uint32_t dummy);
Michael J. Spencer 2:1df0b61d3b5a 37 uint32_t stepper_motor_finished_move(uint32_t dummy);
scachat 0:31e91bb0ef3c 38 int config_step_timer( int cycles );
Michael J. Spencer 2:1df0b61d3b5a 39 void turn_enable_pins_on();
Michael J. Spencer 2:1df0b61d3b5a 40 void turn_enable_pins_off();
Michael J. Spencer 2:1df0b61d3b5a 41 uint32_t synchronize_acceleration(uint32_t dummy);
scachat 0:31e91bb0ef3c 42
scachat 0:31e91bb0ef3c 43 Block* current_block;
scachat 0:31e91bb0ef3c 44 int counters[3];
Michael J. Spencer 2:1df0b61d3b5a 45 int stepped[3];
Michael J. Spencer 2:1df0b61d3b5a 46 int offsets[3];
scachat 0:31e91bb0ef3c 47 float counter_alpha;
scachat 0:31e91bb0ef3c 48 float counter_beta;
scachat 0:31e91bb0ef3c 49 float counter_gamma;
Michael J. Spencer 2:1df0b61d3b5a 50 //int step_events_completed;
Michael J. Spencer 2:1df0b61d3b5a 51 unsigned int out_bits;
Michael J. Spencer 2:1df0b61d3b5a 52 float trapezoid_adjusted_rate;
scachat 0:31e91bb0ef3c 53 int trapezoid_tick_cycle_counter;
Michael J. Spencer 2:1df0b61d3b5a 54 int cycles_per_step_event;
scachat 0:31e91bb0ef3c 55 bool trapezoid_generator_busy;
Michael J. Spencer 2:1df0b61d3b5a 56 int microseconds_per_step_pulse;
scachat 0:31e91bb0ef3c 57 int acceleration_ticks_per_second;
Michael J. Spencer 2:1df0b61d3b5a 58 unsigned int minimum_steps_per_second;
scachat 0:31e91bb0ef3c 59 int base_stepping_frequency;
scachat 0:31e91bb0ef3c 60 unsigned short step_bits[3];
scachat 0:31e91bb0ef3c 61 int counter_increment;
scachat 0:31e91bb0ef3c 62 bool paused;
Michael J. Spencer 2:1df0b61d3b5a 63 bool force_speed_update;
Michael J. Spencer 2:1df0b61d3b5a 64 bool enable_pins_status;
Michael J. Spencer 2:1df0b61d3b5a 65 Hook* acceleration_tick_hook;
Michael J. Spencer 2:1df0b61d3b5a 66
Michael J. Spencer 2:1df0b61d3b5a 67 StepperMotor* main_stepper;
Michael J. Spencer 2:1df0b61d3b5a 68
scachat 0:31e91bb0ef3c 69 };
scachat 0:31e91bb0ef3c 70
scachat 0:31e91bb0ef3c 71
scachat 0:31e91bb0ef3c 72
scachat 0:31e91bb0ef3c 73
scachat 0:31e91bb0ef3c 74 #endif