Committer:
Sergunb
Date:
Mon Sep 04 12:04:13 2017 +0000
Revision:
0:8f0d870509fe
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sergunb 0:8f0d870509fe 1 /*
Sergunb 0:8f0d870509fe 2 stepper.h - stepper motor driver: executes motion plans of planner.c using the stepper motors
Sergunb 0:8f0d870509fe 3 Part of Grbl
Sergunb 0:8f0d870509fe 4
Sergunb 0:8f0d870509fe 5 Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
Sergunb 0:8f0d870509fe 6 Copyright (c) 2009-2011 Simen Svale Skogsrud
Sergunb 0:8f0d870509fe 7
Sergunb 0:8f0d870509fe 8 Grbl is free software: you can redistribute it and/or modify
Sergunb 0:8f0d870509fe 9 it under the terms of the GNU General Public License as published by
Sergunb 0:8f0d870509fe 10 the Free Software Foundation, either version 3 of the License, or
Sergunb 0:8f0d870509fe 11 (at your option) any later version.
Sergunb 0:8f0d870509fe 12
Sergunb 0:8f0d870509fe 13 Grbl is distributed in the hope that it will be useful,
Sergunb 0:8f0d870509fe 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
Sergunb 0:8f0d870509fe 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Sergunb 0:8f0d870509fe 16 GNU General Public License for more details.
Sergunb 0:8f0d870509fe 17
Sergunb 0:8f0d870509fe 18 You should have received a copy of the GNU General Public License
Sergunb 0:8f0d870509fe 19 along with Grbl. If not, see <http://www.gnu.org/licenses/>.
Sergunb 0:8f0d870509fe 20 */
Sergunb 0:8f0d870509fe 21
Sergunb 0:8f0d870509fe 22 #ifndef stepper_h
Sergunb 0:8f0d870509fe 23 #define stepper_h
Sergunb 0:8f0d870509fe 24
Sergunb 0:8f0d870509fe 25 #ifndef SEGMENT_BUFFER_SIZE
Sergunb 0:8f0d870509fe 26 #ifdef AVRTARGET
Sergunb 0:8f0d870509fe 27 #define SEGMENT_BUFFER_SIZE 6
Sergunb 0:8f0d870509fe 28 #else
Sergunb 0:8f0d870509fe 29 #define SEGMENT_BUFFER_SIZE 10
Sergunb 0:8f0d870509fe 30 #endif
Sergunb 0:8f0d870509fe 31 #endif
Sergunb 0:8f0d870509fe 32
Sergunb 0:8f0d870509fe 33 // Initialize and setup the stepper motor subsystem
Sergunb 0:8f0d870509fe 34 void stepper_init();
Sergunb 0:8f0d870509fe 35
Sergunb 0:8f0d870509fe 36 // Enable steppers, but cycle does not start unless called by motion control or realtime command.
Sergunb 0:8f0d870509fe 37 void st_wake_up();
Sergunb 0:8f0d870509fe 38
Sergunb 0:8f0d870509fe 39 // Immediately disables steppers
Sergunb 0:8f0d870509fe 40 void st_go_idle();
Sergunb 0:8f0d870509fe 41
Sergunb 0:8f0d870509fe 42 // Generate the step and direction port invert masks.
Sergunb 0:8f0d870509fe 43 void st_generate_step_dir_invert_masks();
Sergunb 0:8f0d870509fe 44
Sergunb 0:8f0d870509fe 45 // Reset the stepper subsystem variables
Sergunb 0:8f0d870509fe 46 void st_reset();
Sergunb 0:8f0d870509fe 47
Sergunb 0:8f0d870509fe 48 // Changes the run state of the step segment buffer to execute the special parking motion.
Sergunb 0:8f0d870509fe 49 void st_parking_setup_buffer();
Sergunb 0:8f0d870509fe 50
Sergunb 0:8f0d870509fe 51 // Restores the step segment buffer to the normal run state after a parking motion.
Sergunb 0:8f0d870509fe 52 void st_parking_restore_buffer();
Sergunb 0:8f0d870509fe 53
Sergunb 0:8f0d870509fe 54 // Reloads step segment buffer. Called continuously by realtime execution system.
Sergunb 0:8f0d870509fe 55 void st_prep_buffer();
Sergunb 0:8f0d870509fe 56
Sergunb 0:8f0d870509fe 57 // Called by planner_recalculate() when the executing block is updated by the new plan.
Sergunb 0:8f0d870509fe 58 void st_update_plan_block_parameters();
Sergunb 0:8f0d870509fe 59
Sergunb 0:8f0d870509fe 60 // Called by realtime status reporting if realtime rate reporting is enabled in config.h.
Sergunb 0:8f0d870509fe 61 float st_get_realtime_rate();
Sergunb 0:8f0d870509fe 62
Sergunb 0:8f0d870509fe 63 extern const PORTPINDEF step_pin_mask[N_AXIS];
Sergunb 0:8f0d870509fe 64 extern const PORTPINDEF direction_pin_mask[N_AXIS];
Sergunb 0:8f0d870509fe 65 extern const PORTPINDEF limit_pin_mask[N_AXIS];
Sergunb 0:8f0d870509fe 66
Sergunb 0:8f0d870509fe 67 #endif