|
|
@ -57,9 +57,9 @@
|
|
|
|
#define TEMP_TIMER 2
|
|
|
|
#define TEMP_TIMER 2
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#elif defined(STM32F4xx) || defined(STM32F7xx)
|
|
|
|
#elif defined(STM32F401xC) || defined(STM32F401xE)
|
|
|
|
|
|
|
|
|
|
|
|
#define HAL_TIMER_RATE (F_CPU/2) // frequency of timer peripherals
|
|
|
|
#define HAL_TIMER_RATE (F_CPU / 2) // frequency of timer peripherals
|
|
|
|
|
|
|
|
|
|
|
|
// STM32F401 only has timers 1-5 & 9-11 with timers 4 & 5 usually assigned to TIMER_SERVO and TIMER_TONE
|
|
|
|
// STM32F401 only has timers 1-5 & 9-11 with timers 4 & 5 usually assigned to TIMER_SERVO and TIMER_TONE
|
|
|
|
|
|
|
|
|
|
|
@ -71,6 +71,30 @@
|
|
|
|
#define TEMP_TIMER 10
|
|
|
|
#define TEMP_TIMER 10
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#elif defined(STM32F4xx)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define HAL_TIMER_RATE (F_CPU / 2) // frequency of timer peripherals
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef STEP_TIMER
|
|
|
|
|
|
|
|
#define STEP_TIMER 6
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef TEMP_TIMER
|
|
|
|
|
|
|
|
#define TEMP_TIMER 14
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#elif defined(STM32F7xx)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define HAL_TIMER_RATE (F_CPU/2) // frequency of timer peripherals
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef STEP_TIMER
|
|
|
|
|
|
|
|
#define STEP_TIMER 6
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef TEMP_TIMER
|
|
|
|
|
|
|
|
#define TEMP_TIMER 14
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SWSERIAL_TIMER_IRQ_PRIO
|
|
|
|
#ifndef SWSERIAL_TIMER_IRQ_PRIO
|
|
|
@ -82,16 +106,16 @@
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef TEMP_TIMER_IRQ_PRIO
|
|
|
|
#ifndef TEMP_TIMER_IRQ_PRIO
|
|
|
|
#define TEMP_TIMER_IRQ_PRIO 14 //14 = after hardware ISRs
|
|
|
|
#define TEMP_TIMER_IRQ_PRIO 14 // 14 = after hardware ISRs
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define STEP_TIMER_NUM 0 // index of timer to use for stepper
|
|
|
|
#define STEP_TIMER_NUM 0 // index of timer to use for stepper
|
|
|
|
#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 TEMP_TIMER_FREQUENCY 1000 //Temperature::isr() is expected to be called at around 1kHz
|
|
|
|
#define TEMP_TIMER_FREQUENCY 1000 // Temperature::isr() is expected to be called at around 1kHz
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
|
|
|
|
// TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
|
|
|
|
#define STEPPER_TIMER_RATE 2000000 // 2 Mhz
|
|
|
|
#define STEPPER_TIMER_RATE 2000000 // 2 Mhz
|
|
|
|
#define STEPPER_TIMER_PRESCALE ((HAL_TIMER_RATE)/(STEPPER_TIMER_RATE))
|
|
|
|
#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 STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
|
|
|
|