Add HAL_timer_start to HAL.h

Co-Authored-By: ejtagle <ejtagle@hotmail.com>
This commit is contained in:
Scott Lahteine 2018-06-09 21:28:37 -05:00
parent 1b1e15623a
commit 63af814d4d
3 changed files with 34 additions and 20 deletions

View file

@ -1947,22 +1947,8 @@ void Stepper::init() {
E_AXIS_INIT(4);
#endif
// waveform generation = 0100 = CTC
SET_WGM(1, CTC_OCRnA);
// output mode = 00 (disconnected)
SET_COMA(1, NORMAL);
// Set the timer pre-scaler
// 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
// sure to regenerate speed_lookuptable.h with
// create_speed_lookuptable.py
SET_CS(1, PRESCALER_8); // CS 2 = 1/8 prescaler
// Init Stepper ISR to 122 Hz for quick starting
OCR1A = 0x4000;
TCNT1 = 0;
HAL_timer_start(STEP_TIMER_NUM, 122); // OCR1A = 0x4000
ENABLE_STEPPER_DRIVER_INTERRUPT();