Add an option to specify "pulse" timer
This commit is contained in:
@ -109,6 +109,10 @@ extern "C" {
|
||||
#define STEPPER_TIMER_PRESCALE 8
|
||||
#define HAL_TICKS_PER_US ((HAL_STEPPER_TIMER_RATE) / 1000000) // Cannot be of type double
|
||||
|
||||
#define PULSE_TIMER_NUM TEMP_TIMER_NUM
|
||||
#define TIMER_COUNTER_0 TCNT0
|
||||
#define PULSE_TIMER_PRESCALE 8
|
||||
|
||||
#define ENABLE_STEPPER_DRIVER_INTERRUPT() SBI(TIMSK1, OCIE1A)
|
||||
#define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
|
||||
|
||||
|
@ -64,6 +64,9 @@ typedef uint32_t hal_timer_t;
|
||||
#define HAL_STEP_TIMER_ISR void TC3_Handler()
|
||||
#define HAL_TEMP_TIMER_ISR void TC4_Handler()
|
||||
|
||||
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
||||
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Types
|
||||
// --------------------------------------------------------------------------
|
||||
|
@ -53,6 +53,9 @@ typedef uint32_t hal_timer_t;
|
||||
#define HAL_TEMP_TIMER_RATE 1000000
|
||||
#define TEMP_TIMER_FREQUENCY 1000 // temperature interrupt frequency
|
||||
|
||||
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
||||
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
|
||||
|
||||
#define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM)
|
||||
#define DISABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_disable_interrupt(STEP_TIMER_NUM)
|
||||
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
|
||||
|
@ -56,6 +56,9 @@ typedef uint16_t hal_timer_t;
|
||||
#define HAL_STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)
|
||||
#define HAL_TICKS_PER_US ((HAL_STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per us
|
||||
|
||||
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
||||
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
|
||||
|
||||
#define TEMP_TIMER_PRESCALE 1000 // prescaler for setting Temp timer, 72Khz
|
||||
#define TEMP_TIMER_FREQUENCY 1000 // temperature interrupt frequency
|
||||
|
||||
|
@ -57,6 +57,9 @@ typedef uint32_t hal_timer_t;
|
||||
#define STEPPER_TIMER STEP_TIMER_NUM // Alias?
|
||||
#define STEPPER_TIMER_PRESCALE 0 // Not defined anywhere else!
|
||||
|
||||
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
||||
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
|
||||
|
||||
#define HAL_TIMER_RATE (FTM0_TIMER_RATE)
|
||||
#define HAL_STEPPER_TIMER_RATE HAL_TIMER_RATE
|
||||
#define HAL_TICKS_PER_US ((HAL_STEPPER_TIMER_RATE) / 1000000)
|
||||
|
Reference in New Issue
Block a user