|
|
@ -1136,27 +1136,27 @@ void Stepper::init() {
|
|
|
|
E_AXIS_INIT(4);
|
|
|
|
E_AXIS_INIT(4);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ARDUINO_ARCH_AVR
|
|
|
|
#ifdef ARDUINO_ARCH_AVR
|
|
|
|
// waveform generation = 0100 = CTC
|
|
|
|
// waveform generation = 0100 = CTC
|
|
|
|
SET_WGM(1, CTC_OCRnA);
|
|
|
|
SET_WGM(1, CTC_OCRnA);
|
|
|
|
|
|
|
|
|
|
|
|
// output mode = 00 (disconnected)
|
|
|
|
// output mode = 00 (disconnected)
|
|
|
|
SET_COMA(1, NORMAL);
|
|
|
|
SET_COMA(1, NORMAL);
|
|
|
|
|
|
|
|
|
|
|
|
// Set the timer pre-scaler
|
|
|
|
// Set the timer pre-scaler
|
|
|
|
// Generally we use a divider of 8, resulting in a 2MHz timer
|
|
|
|
// Generally we use a divider of 8, resulting in a 2MHz timer
|
|
|
|
// frequency on a 16MHz MCU. If you are going to change this, be
|
|
|
|
// frequency on a 16MHz MCU. If you are going to change this, be
|
|
|
|
// sure to regenerate speed_lookuptable.h with
|
|
|
|
// sure to regenerate speed_lookuptable.h with
|
|
|
|
// create_speed_lookuptable.py
|
|
|
|
// create_speed_lookuptable.py
|
|
|
|
SET_CS(1, PRESCALER_8); // CS 2 = 1/8 prescaler
|
|
|
|
SET_CS(1, PRESCALER_8); // CS 2 = 1/8 prescaler
|
|
|
|
|
|
|
|
|
|
|
|
// Init Stepper ISR to 122 Hz for quick starting
|
|
|
|
// Init Stepper ISR to 122 Hz for quick starting
|
|
|
|
OCR1A = 0x4000;
|
|
|
|
OCR1A = 0x4000;
|
|
|
|
TCNT1 = 0;
|
|
|
|
TCNT1 = 0;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
// Init Stepper ISR to 122 Hz for quick starting
|
|
|
|
// Init Stepper ISR to 122 Hz for quick starting
|
|
|
|
HAL_timer_start(STEP_TIMER_NUM, 122);
|
|
|
|
HAL_timer_start(STEP_TIMER_NUM, 122);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
ENABLE_STEPPER_DRIVER_INTERRUPT();
|
|
|
|
ENABLE_STEPPER_DRIVER_INTERRUPT();
|
|
|
|
|
|
|
|
|
|
|
|