smoothie port to mbed online compiler (smoothieware.org)

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Stepper.h Source File

Stepper.h

00001 /*  
00002       This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
00003       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.
00004       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.
00005       You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. 
00006 */
00007 
00008 #ifndef STEPPER_H
00009 #define STEPPER_H
00010 #include "libs/Module.h"
00011 #include "libs/Kernel.h"
00012 #include "Planner.h"
00013 #include "Block.h"
00014 
00015 #define microseconds_per_step_pulse_checksum        42333
00016 #define acceleration_ticks_per_second_checksum      25075
00017 #define minimum_steps_per_minute_checksum           9003
00018 #define base_stepping_frequency_checksum            21918
00019 #define alpha_step_pin_checksum                     11468
00020 #define beta_step_pin_checksum                      22114
00021 #define gamma_step_pin_checksum                     1225
00022 #define alpha_dir_pin_checksum                      55887
00023 #define beta_dir_pin_checksum                       28644
00024 #define gamma_dir_pin_checksum                      46412
00025 #define alpha_en_pin_checksum                       35042  
00026 #define beta_en_pin_checksum                        34680 
00027 #define gamma_en_pin_checksum                       26335 
00028 
00029 
00030 class Stepper : public Module {
00031     public:
00032         Stepper();
00033         virtual void on_module_loaded();
00034         virtual void on_config_reload(void* argument);
00035         virtual void on_block_begin(void* argument);
00036         virtual void on_block_end(void* argument);
00037         virtual void on_gcode_execute(void* argument);
00038         virtual void on_play(void* argument);
00039         virtual void on_pause(void* argument);
00040         uint32_t main_interrupt(uint32_t dummy);
00041         void trapezoid_generator_reset();
00042         void set_step_events_per_minute(double steps_per_minute);
00043         uint32_t trapezoid_generator_tick(uint32_t dummy);
00044         uint32_t reset_step_pins(uint32_t dummy);
00045         void update_offsets();
00046         int config_step_timer( int cycles );
00047 
00048         Block* current_block;
00049         int counters[3];
00050         int stepped[3]; 
00051         int offsets[3]; 
00052         float counter_alpha;
00053         float counter_beta;
00054         float counter_gamma;
00055         int step_events_completed; 
00056         unsigned int out_bits; 
00057         double trapezoid_adjusted_rate;
00058         int trapezoid_tick_cycle_counter;
00059         int cycles_per_step_event; 
00060         bool trapezoid_generator_busy;
00061         int microseconds_per_step_pulse; 
00062         int acceleration_ticks_per_second;
00063         int divider;
00064         int minimum_steps_per_minute;
00065         int base_stepping_frequency;
00066         Pin* alpha_step_pin;
00067         Pin* beta_step_pin;
00068         Pin* gamma_step_pin;
00069         Pin* alpha_dir_pin;
00070         Pin* beta_dir_pin;
00071         Pin* gamma_dir_pin;
00072         Pin* alpha_en_pin;
00073         Pin* beta_en_pin;
00074         Pin* gamma_en_pin;
00075         unsigned short step_bits[3];
00076         int counter_increment;
00077         bool paused;
00078 };
00079 
00080 
00081 
00082 
00083 #endif