Browse Source

Fix name collision. timer_t => hal_timer_t

Scott Lahteine 7 years ago
parent
commit
2246316605

+ 1
- 1
Marlin/src/HAL/HAL_AVR/HAL_AVR.h View File

@@ -66,7 +66,7 @@
66 66
 // Types
67 67
 // --------------------------------------------------------------------------
68 68
 
69
-typedef uint16_t timer_t;
69
+typedef uint16_t hal_timer_t;
70 70
 #define HAL_TIMER_TYPE_MAX 0xFFFF
71 71
 
72 72
 typedef int8_t pin_t;

+ 2
- 2
Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h View File

@@ -40,7 +40,7 @@
40 40
 
41 41
 #define FORCE_INLINE __attribute__((always_inline)) inline
42 42
 
43
-typedef uint32_t timer_t;
43
+typedef uint32_t hal_timer_t;
44 44
 #define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
45 45
 
46 46
 #define STEP_TIMER_NUM 3  // index of timer to use for stepper
@@ -92,7 +92,7 @@ static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const uint
92 92
   pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC = count;
93 93
 }
94 94
 
95
-static FORCE_INLINE timer_t HAL_timer_get_count(const uint8_t timer_num) {
95
+static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
96 96
   const tTimerConfig *pConfig = &TimerConfig[timer_num];
97 97
   return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC;
98 98
 }

+ 4
- 4
Marlin/src/HAL/HAL_LPC1768/HAL_timers.h View File

@@ -40,7 +40,7 @@
40 40
 
41 41
 #define FORCE_INLINE __attribute__((always_inline)) inline
42 42
 
43
-typedef uint32_t timer_t;
43
+typedef uint32_t hal_timer_t;
44 44
 #define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
45 45
 
46 46
 #define STEP_TIMER_NUM 0  // index of timer to use for stepper
@@ -77,7 +77,7 @@ typedef uint32_t timer_t;
77 77
 void HAL_timer_init(void);
78 78
 void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
79 79
 
80
-static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const timer_t count) {
80
+static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const hal_timer_t count) {
81 81
   switch (timer_num) {
82 82
     case 0:
83 83
       LPC_TIM0->MR0 = count;
@@ -92,7 +92,7 @@ static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const time
92 92
   }
93 93
 }
94 94
 
95
-static FORCE_INLINE timer_t HAL_timer_get_count(const uint8_t timer_num) {
95
+static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
96 96
   switch (timer_num) {
97 97
     case 0: return LPC_TIM0->MR0;
98 98
     case 1: return LPC_TIM1->MR0;
@@ -100,7 +100,7 @@ static FORCE_INLINE timer_t HAL_timer_get_count(const uint8_t timer_num) {
100 100
   return 0;
101 101
 }
102 102
 
103
-static FORCE_INLINE timer_t HAL_timer_get_current_count(const uint8_t timer_num) {
103
+static FORCE_INLINE hal_timer_t HAL_timer_get_current_count(const uint8_t timer_num) {
104 104
   switch (timer_num) {
105 105
     case 0: return LPC_TIM0->TC;
106 106
     case 1: return LPC_TIM1->TC;

+ 5
- 5
Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h View File

@@ -43,7 +43,7 @@
43 43
  */
44 44
 #define FORCE_INLINE __attribute__((always_inline)) inline
45 45
 
46
-typedef uint16_t timer_t;
46
+typedef uint16_t hal_timer_t;
47 47
 #define HAL_TIMER_TYPE_MAX 0xFFFF
48 48
 
49 49
 #define STEP_TIMER_NUM 5  // index of timer to use for stepper
@@ -126,8 +126,8 @@ static FORCE_INLINE void HAL_timer_set_count (uint8_t timer_num, uint32_t count)
126 126
   }
127 127
 }
128 128
 
129
-static FORCE_INLINE timer_t HAL_timer_get_count (uint8_t timer_num) {
130
-  timer_t temp;
129
+static FORCE_INLINE hal_timer_t HAL_timer_get_count (uint8_t timer_num) {
130
+  hal_timer_t temp;
131 131
   switch (timer_num) {
132 132
   case STEP_TIMER_NUM:
133 133
     temp = StepperTimer.getCompare(STEP_TIMER_CHAN);
@@ -142,8 +142,8 @@ static FORCE_INLINE timer_t HAL_timer_get_count (uint8_t timer_num) {
142 142
   return temp;
143 143
 }
144 144
 
145
-static FORCE_INLINE timer_t HAL_timer_get_current_count(uint8_t timer_num) {
146
-  timer_t temp;
145
+static FORCE_INLINE hal_timer_t HAL_timer_get_current_count(uint8_t timer_num) {
146
+  hal_timer_t temp;
147 147
   switch (timer_num) {
148 148
   case STEP_TIMER_NUM:
149 149
     temp = StepperTimer.getCount();

+ 2
- 2
Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h View File

@@ -40,7 +40,7 @@
40 40
 
41 41
 #define FORCE_INLINE __attribute__((always_inline)) inline
42 42
 
43
-typedef uint32_t timer_t;
43
+typedef uint32_t hal_timer_t;
44 44
 #define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
45 45
 
46 46
 #define STEP_TIMER_NUM 0
@@ -82,7 +82,7 @@ static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const uint
82 82
   }
83 83
 }
84 84
 
85
-static FORCE_INLINE timer_t HAL_timer_get_count(const uint8_t timer_num) {
85
+static FORCE_INLINE hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
86 86
   switch(timer_num) {
87 87
     case 0: return FTM0_C0V;
88 88
     case 1: return FTM1_C0V;

+ 11
- 11
Marlin/src/module/stepper.cpp View File

@@ -120,9 +120,9 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even
120 120
 
121 121
 #if ENABLED(LIN_ADVANCE)
122 122
 
123
-  constexpr timer_t ADV_NEVER = HAL_TIMER_TYPE_MAX;
123
+  constexpr hal_timer_t ADV_NEVER = HAL_TIMER_TYPE_MAX;
124 124
 
125
-  timer_t Stepper::nextMainISR = 0,
125
+  hal_timer_t Stepper::nextMainISR = 0,
126 126
          Stepper::nextAdvanceISR = ADV_NEVER,
127 127
          Stepper::eISR_Rate = ADV_NEVER;
128 128
 
@@ -137,9 +137,9 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even
137 137
    * This fix isn't perfect and may lose steps - but better than locking up completely
138 138
    * in future the planner should slow down if advance stepping rate would be too high
139 139
    */
140
-  FORCE_INLINE timer_t adv_rate(const int steps, const timer_t timer, const uint8_t loops) {
140
+  FORCE_INLINE hal_timer_t adv_rate(const int steps, const hal_timer_t timer, const uint8_t loops) {
141 141
     if (steps) {
142
-      const timer_t rate = (timer * loops) / abs(steps);
142
+      const hal_timer_t rate = (timer * loops) / abs(steps);
143 143
       //return constrain(rate, 1, ADV_NEVER - 1)
144 144
       return rate ? rate : 1;
145 145
     }
@@ -157,9 +157,9 @@ volatile signed char Stepper::count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
157 157
   long Stepper::counter_m[MIXING_STEPPERS];
158 158
 #endif
159 159
 
160
-timer_t Stepper::acc_step_rate; // needed for deceleration start point
160
+hal_timer_t Stepper::acc_step_rate; // needed for deceleration start point
161 161
 uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
162
-timer_t Stepper::OCR1A_nominal;
162
+hal_timer_t Stepper::OCR1A_nominal;
163 163
 
164 164
 volatile long Stepper::endstops_trigsteps[XYZ];
165 165
 
@@ -341,7 +341,7 @@ HAL_STEP_TIMER_ISR {
341 341
 
342 342
 void Stepper::isr() {
343 343
 
344
-  timer_t ocr_val;
344
+  hal_timer_t ocr_val;
345 345
 
346 346
   #define ENDSTOP_NOMINAL_OCR_VAL 1500 * HAL_TICKS_PER_US    // check endstops every 1.5ms to guarantee two stepper ISRs within 5ms for BLTouch
347 347
   #define OCR_VAL_TOLERANCE 500 * HAL_TICKS_PER_US           // First max delay is 2.0ms, last min delay is 0.5ms, all others 1.5ms
@@ -677,7 +677,7 @@ void Stepper::isr() {
677 677
     NOMORE(acc_step_rate, current_block->nominal_rate);
678 678
 
679 679
     // step_rate to timer interval
680
-    const timer_t timer = calc_timer(acc_step_rate);
680
+    const hal_timer_t timer = calc_timer(acc_step_rate);
681 681
 
682 682
     SPLIT(timer);  // split step into multiple ISRs if larger than  ENDSTOP_NOMINAL_OCR_VAL
683 683
     _NEXT_ISR(ocr_val);
@@ -699,7 +699,7 @@ void Stepper::isr() {
699 699
     #endif // LIN_ADVANCE
700 700
   }
701 701
   else if (step_events_completed > (uint32_t)current_block->decelerate_after) {
702
-    timer_t step_rate;
702
+    hal_timer_t step_rate;
703 703
     #ifdef CPU_32_BIT
704 704
       MultiU32X24toH32(step_rate, deceleration_time, current_block->acceleration_rate);
705 705
     #else
@@ -714,7 +714,7 @@ void Stepper::isr() {
714 714
       step_rate = current_block->final_rate;
715 715
 
716 716
     // step_rate to timer interval
717
-    const timer_t timer = calc_timer(step_rate);
717
+    const hal_timer_t timer = calc_timer(step_rate);
718 718
 
719 719
     SPLIT(timer);  // split step into multiple ISRs if larger than  ENDSTOP_NOMINAL_OCR_VAL
720 720
     _NEXT_ISR(ocr_val);
@@ -754,7 +754,7 @@ void Stepper::isr() {
754 754
   #if DISABLED(LIN_ADVANCE)
755 755
     #ifdef CPU_32_BIT
756 756
       // Make sure stepper interrupt does not monopolise CPU by adjusting count to give about 8 us room
757
-      timer_t stepper_timer_count = HAL_timer_get_count(STEP_TIMER_NUM),
757
+      hal_timer_t stepper_timer_count = HAL_timer_get_count(STEP_TIMER_NUM),
758 758
                      stepper_timer_current_count = HAL_timer_get_current_count(STEP_TIMER_NUM) + 8 * HAL_TICKS_PER_US;
759 759
       HAL_timer_set_count(STEP_TIMER_NUM, max(stepper_timer_count, stepper_timer_current_count));
760 760
     #else

+ 5
- 5
Marlin/src/module/stepper.h View File

@@ -97,7 +97,7 @@ class Stepper {
97 97
     static volatile uint32_t step_events_completed; // The number of step events executed in the current block
98 98
 
99 99
     #if ENABLED(LIN_ADVANCE)
100
-      static timer_t nextMainISR, nextAdvanceISR, eISR_Rate;
100
+      static hal_timer_t nextMainISR, nextAdvanceISR, eISR_Rate;
101 101
       #define _NEXT_ISR(T) nextMainISR = T
102 102
 
103 103
       static volatile int e_steps[E_STEPPERS];
@@ -112,9 +112,9 @@ class Stepper {
112 112
 
113 113
     static long acceleration_time, deceleration_time;
114 114
     //unsigned long accelerate_until, decelerate_after, acceleration_rate, initial_rate, final_rate, nominal_rate;
115
-    static timer_t acc_step_rate; // needed for deceleration start point
115
+    static hal_timer_t acc_step_rate; // needed for deceleration start point
116 116
     static uint8_t step_loops, step_loops_nominal;
117
-    static timer_t OCR1A_nominal;
117
+    static hal_timer_t OCR1A_nominal;
118 118
 
119 119
     static volatile long endstops_trigsteps[XYZ];
120 120
     static volatile long endstops_stepsTotal, endstops_stepsDone;
@@ -277,8 +277,8 @@ class Stepper {
277 277
 
278 278
   private:
279 279
 
280
-    static FORCE_INLINE timer_t calc_timer(timer_t step_rate) {
281
-      timer_t timer;
280
+    static FORCE_INLINE hal_timer_t calc_timer(hal_timer_t step_rate) {
281
+      hal_timer_t timer;
282 282
 
283 283
       NOMORE(step_rate, MAX_STEP_FREQUENCY);
284 284
 

Loading…
Cancel
Save