Browse Source

Allow STM32 HAL_TIMER_RATE override (#18374)

Chris Barr 5 years ago
parent
commit
900d4cf8e7
No account linked to committer's email address
2 changed files with 8 additions and 4 deletions
  1. 7
    4
      Marlin/src/HAL/STM32/timers.cpp
  2. 1
    0
      Marlin/src/pins/stm32f4/pins_RUMBA32_common.h

+ 7
- 4
Marlin/src/HAL/STM32/timers.cpp View File

@@ -44,23 +44,26 @@
44 44
 #endif
45 45
 
46 46
 #ifdef STM32F0xx
47
-  #define HAL_TIMER_RATE (F_CPU)      // Frequency of timer peripherals
47
+  #define MCU_TIMER_RATE (F_CPU)      // Frequency of timer peripherals
48 48
   #define MCU_STEP_TIMER 16
49 49
   #define MCU_TEMP_TIMER 17
50 50
 #elif defined(STM32F1xx)
51
-  #define HAL_TIMER_RATE (F_CPU)
51
+  #define MCU_TIMER_RATE (F_CPU)
52 52
   #define MCU_STEP_TIMER  4
53 53
   #define MCU_TEMP_TIMER  2
54 54
 #elif defined(STM32F401xC) || defined(STM32F401xE)
55
-  #define HAL_TIMER_RATE (F_CPU / 2)
55
+  #define MCU_TIMER_RATE (F_CPU / 2)
56 56
   #define MCU_STEP_TIMER  9
57 57
   #define MCU_TEMP_TIMER 10
58 58
 #elif defined(STM32F4xx) || defined(STM32F7xx)
59
-  #define HAL_TIMER_RATE (F_CPU / 2)
59
+  #define MCU_TIMER_RATE (F_CPU / 2)
60 60
   #define MCU_STEP_TIMER  6           // STM32F401 has no TIM6, TIM7, or TIM8
61 61
   #define MCU_TEMP_TIMER 14           // TIM7 is consumed by Software Serial if used.
62 62
 #endif
63 63
 
64
+#ifndef HAL_TIMER_RATE
65
+  #define HAL_TIMER_RATE MCU_TIMER_RATE
66
+#endif
64 67
 #ifndef STEP_TIMER
65 68
   #define STEP_TIMER MCU_STEP_TIMER
66 69
 #endif

+ 1
- 0
Marlin/src/pins/stm32f4/pins_RUMBA32_common.h View File

@@ -47,6 +47,7 @@
47 47
 #define STEP_TIMER                          10
48 48
 #define TEMP_TIMER                          14
49 49
 #define TIMER_SERIAL                        TIM9
50
+#define HAL_TIMER_RATE                      F_CPU
50 51
 
51 52
 //
52 53
 // Limit Switches

Loading…
Cancel
Save