|
|
@ -33,14 +33,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
#define FORCE_INLINE __attribute__((always_inline)) inline
|
|
|
|
#define FORCE_INLINE __attribute__((always_inline)) inline
|
|
|
|
|
|
|
|
|
|
|
|
#define hal_timer_t uint32_t // TODO: One is 16-bit, one 32-bit - does this need to be checked?
|
|
|
|
#define hal_timer_t uint32_t
|
|
|
|
#define HAL_TIMER_TYPE_MAX 0xFFFF
|
|
|
|
#define HAL_TIMER_TYPE_MAX 0xFFFF
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef STM32F0xx
|
|
|
|
#ifdef STM32F0xx
|
|
|
|
|
|
|
|
|
|
|
|
#define HAL_TIMER_RATE (HAL_RCC_GetSysClockFreq()) // frequency of timer peripherals
|
|
|
|
#define HAL_TIMER_RATE (HAL_RCC_GetSysClockFreq()) // frequency of timer peripherals
|
|
|
|
#define TEMP_TIMER_PRESCALE 666 // prescaler for setting temperature timer, 72Khz
|
|
|
|
|
|
|
|
#define STEPPER_TIMER_PRESCALE 24 // prescaler for setting stepper timer, 2Mhz
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define STEP_TIMER 16
|
|
|
|
#define STEP_TIMER 16
|
|
|
|
#define TEMP_TIMER 17
|
|
|
|
#define TEMP_TIMER 17
|
|
|
@ -48,8 +46,6 @@
|
|
|
|
#elif defined STM32F1xx
|
|
|
|
#elif defined STM32F1xx
|
|
|
|
|
|
|
|
|
|
|
|
#define HAL_TIMER_RATE (HAL_RCC_GetPCLK2Freq()) // frequency of timer peripherals
|
|
|
|
#define HAL_TIMER_RATE (HAL_RCC_GetPCLK2Freq()) // frequency of timer peripherals
|
|
|
|
#define TEMP_TIMER_PRESCALE 1000 // prescaler for setting temperature timer, 72Khz
|
|
|
|
|
|
|
|
#define STEPPER_TIMER_PRESCALE 36 // prescaler for setting stepper timer, 2Mhz.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define STEP_TIMER 4
|
|
|
|
#define STEP_TIMER 4
|
|
|
|
#define TEMP_TIMER 2
|
|
|
|
#define TEMP_TIMER 2
|
|
|
@ -57,8 +53,6 @@
|
|
|
|
#elif defined STM32F4xx
|
|
|
|
#elif defined STM32F4xx
|
|
|
|
|
|
|
|
|
|
|
|
#define HAL_TIMER_RATE (HAL_RCC_GetPCLK2Freq()) // frequency of timer peripherals
|
|
|
|
#define HAL_TIMER_RATE (HAL_RCC_GetPCLK2Freq()) // frequency of timer peripherals
|
|
|
|
#define TEMP_TIMER_PRESCALE 2333 // prescaler for setting temperature timer, 72Khz
|
|
|
|
|
|
|
|
#define STEPPER_TIMER_PRESCALE 84 // prescaler for setting stepper timer, 2Mhz
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define STEP_TIMER 4
|
|
|
|
#define STEP_TIMER 4
|
|
|
|
#define TEMP_TIMER 5
|
|
|
|
#define TEMP_TIMER 5
|
|
|
@ -66,8 +60,6 @@
|
|
|
|
#elif defined STM32F7xx
|
|
|
|
#elif defined STM32F7xx
|
|
|
|
|
|
|
|
|
|
|
|
#define HAL_TIMER_RATE (HAL_RCC_GetSysClockFreq()/2) // frequency of timer peripherals
|
|
|
|
#define HAL_TIMER_RATE (HAL_RCC_GetSysClockFreq()/2) // frequency of timer peripherals
|
|
|
|
#define TEMP_TIMER_PRESCALE 1500 // prescaler for setting temperature timer, 72Khz
|
|
|
|
|
|
|
|
#define STEPPER_TIMER_PRESCALE 54 // prescaler for setting stepper timer, 2Mhz.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define STEP_TIMER 5
|
|
|
|
#define STEP_TIMER 5
|
|
|
|
#define TEMP_TIMER 7
|
|
|
|
#define TEMP_TIMER 7
|
|
|
@ -82,12 +74,15 @@
|
|
|
|
#define TEMP_TIMER_NUM 1 // index of timer to use for temperature
|
|
|
|
#define TEMP_TIMER_NUM 1 // index of timer to use for temperature
|
|
|
|
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
|
|
|
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
|
|
|
|
|
|
|
|
|
|
|
#define STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // frequency of stepper timer
|
|
|
|
#define TEMP_TIMER_RATE 72000 // 72 Khz
|
|
|
|
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
|
|
|
|
#define TEMP_TIMER_PRESCALE ((HAL_TIMER_RATE)/(TEMP_TIMER_RATE))
|
|
|
|
|
|
|
|
#define TEMP_TIMER_FREQUENCY 1000
|
|
|
|
|
|
|
|
|
|
|
|
#define TEMP_TIMER_FREQUENCY 1000 // temperature interrupt frequency
|
|
|
|
#define STEPPER_TIMER_RATE 2000000 // 2 Mhz
|
|
|
|
|
|
|
|
#define STEPPER_TIMER_PRESCALE ((HAL_TIMER_RATE)/(STEPPER_TIMER_RATE))
|
|
|
|
|
|
|
|
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
|
|
|
|
|
|
|
|
|
|
|
|
#define PULSE_TIMER_RATE STEPPER_TIMER_RATE // frequency of pulse timer
|
|
|
|
#define PULSE_TIMER_RATE STEPPER_TIMER_RATE
|
|
|
|
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
|
|
|
|
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
|
|
|
|
#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US
|
|
|
|
#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US
|
|
|
|
|
|
|
|
|
|
|
|