|
@@ -57,9 +57,9 @@
|
57
|
57
|
#define TEMP_TIMER 2
|
58
|
58
|
#endif
|
59
|
59
|
|
60
|
|
-#elif defined(STM32F4xx) || defined(STM32F7xx)
|
|
60
|
+#elif defined(STM32F401xC) || defined(STM32F401xE)
|
61
|
61
|
|
62
|
|
- #define HAL_TIMER_RATE (F_CPU/2) // frequency of timer peripherals
|
|
62
|
+ #define HAL_TIMER_RATE (F_CPU / 2) // frequency of timer peripherals
|
63
|
63
|
|
64
|
64
|
// STM32F401 only has timers 1-5 & 9-11 with timers 4 & 5 usually assigned to TIMER_SERVO and TIMER_TONE
|
65
|
65
|
|
|
@@ -71,6 +71,30 @@
|
71
|
71
|
#define TEMP_TIMER 10
|
72
|
72
|
#endif
|
73
|
73
|
|
|
74
|
+#elif defined(STM32F4xx)
|
|
75
|
+
|
|
76
|
+ #define HAL_TIMER_RATE (F_CPU / 2) // frequency of timer peripherals
|
|
77
|
+
|
|
78
|
+ #ifndef STEP_TIMER
|
|
79
|
+ #define STEP_TIMER 6
|
|
80
|
+ #endif
|
|
81
|
+
|
|
82
|
+ #ifndef TEMP_TIMER
|
|
83
|
+ #define TEMP_TIMER 14
|
|
84
|
+ #endif
|
|
85
|
+
|
|
86
|
+#elif defined(STM32F7xx)
|
|
87
|
+
|
|
88
|
+ #define HAL_TIMER_RATE (F_CPU/2) // frequency of timer peripherals
|
|
89
|
+
|
|
90
|
+ #ifndef STEP_TIMER
|
|
91
|
+ #define STEP_TIMER 6
|
|
92
|
+ #endif
|
|
93
|
+
|
|
94
|
+ #ifndef TEMP_TIMER
|
|
95
|
+ #define TEMP_TIMER 14
|
|
96
|
+ #endif
|
|
97
|
+
|
74
|
98
|
#endif
|
75
|
99
|
|
76
|
100
|
#ifndef SWSERIAL_TIMER_IRQ_PRIO
|
|
@@ -82,16 +106,16 @@
|
82
|
106
|
#endif
|
83
|
107
|
|
84
|
108
|
#ifndef TEMP_TIMER_IRQ_PRIO
|
85
|
|
- #define TEMP_TIMER_IRQ_PRIO 14 //14 = after hardware ISRs
|
|
109
|
+ #define TEMP_TIMER_IRQ_PRIO 14 // 14 = after hardware ISRs
|
86
|
110
|
#endif
|
87
|
111
|
|
88
|
112
|
#define STEP_TIMER_NUM 0 // index of timer to use for stepper
|
89
|
113
|
#define TEMP_TIMER_NUM 1 // index of timer to use for temperature
|
90
|
114
|
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
91
|
115
|
|
92
|
|
-#define TEMP_TIMER_FREQUENCY 1000 //Temperature::isr() is expected to be called at around 1kHz
|
|
116
|
+#define TEMP_TIMER_FREQUENCY 1000 // Temperature::isr() is expected to be called at around 1kHz
|
93
|
117
|
|
94
|
|
-//TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
|
|
118
|
+// TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
|
95
|
119
|
#define STEPPER_TIMER_RATE 2000000 // 2 Mhz
|
96
|
120
|
#define STEPPER_TIMER_PRESCALE ((HAL_TIMER_RATE)/(STEPPER_TIMER_RATE))
|
97
|
121
|
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
|