From 6a3207391f39734906ffc74d520a17ea503a3bee Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 31 Aug 2018 16:17:10 -0500 Subject: [PATCH] Remove obsolete HAL_timer_restrain --- Marlin/src/HAL/HAL_AVR/HAL.h | 2 -- Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h | 6 ------ Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h | 6 ------ Marlin/src/HAL/HAL_LPC1768/HAL_timers.h | 5 ----- Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h | 5 ----- Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h | 6 ------ Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp | 5 ----- Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h | 2 -- Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h | 5 ----- Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h | 5 ----- 10 files changed, 47 deletions(-) diff --git a/Marlin/src/HAL/HAL_AVR/HAL.h b/Marlin/src/HAL/HAL_AVR/HAL.h index 3ce7d53ef1..84cdc865f0 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL.h +++ b/Marlin/src/HAL/HAL_AVR/HAL.h @@ -170,8 +170,6 @@ FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t freque #define _CAT(a, ...) a ## __VA_ARGS__ #define HAL_timer_set_compare(timer, compare) (_CAT(TIMER_OCR_, timer) = compare) -#define HAL_timer_restrain(timer, interval_ticks) NOLESS(_CAT(TIMER_OCR_, timer), _CAT(TIMER_COUNTER_, timer) + interval_ticks) - #define HAL_timer_get_compare(timer) _CAT(TIMER_OCR_, timer) #define HAL_timer_get_count(timer) _CAT(TIMER_COUNTER_, timer) diff --git a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h index 871ef995e6..dd342f5471 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h +++ b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h @@ -109,12 +109,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_CV; } -// if counter too high then bump up compare -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - void HAL_timer_enable_interrupt(const uint8_t timer_num); void HAL_timer_disable_interrupt(const uint8_t timer_num); bool HAL_timer_interrupt_enabled(const uint8_t timer_num); diff --git a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h index 2ddaf2dcf0..a2d0c0b6db 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h @@ -98,12 +98,6 @@ void HAL_timer_set_compare(const uint8_t timer_num, const hal_timer_t count); hal_timer_t HAL_timer_get_compare(const uint8_t timer_num); hal_timer_t HAL_timer_get_count(const uint8_t timer_num); -// if counter too high then bump up compare -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - void HAL_timer_enable_interrupt(const uint8_t timer_num); void HAL_timer_disable_interrupt(const uint8_t timer_num); bool HAL_timer_interrupt_enabled(const uint8_t timer_num); diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h index 2113335385..4257028fc6 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h @@ -127,11 +127,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { return 0; } -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - FORCE_INLINE static void HAL_timer_enable_interrupt(const uint8_t timer_num) { switch (timer_num) { case 0: NVIC_EnableIRQ(TIMER0_IRQn); // Enable interrupt handler diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h index 132cf4d22f..98542f8374 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h @@ -151,11 +151,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_compare(const uint8_t timer_num) { } } -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) { switch (timer_num) { case STEP_TIMER_NUM: diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h index 943550d13f..83081ed756 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h @@ -120,12 +120,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_compare(const uint8_t timer_num) { return __HAL_TIM_GET_AUTORELOAD(&TimerHandle[timer_num].handle); } -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) - HAL_timer_set_compare(timer_num, mincmp); -} - #ifdef STM32GENERIC FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) { if (__HAL_TIM_GET_FLAG(&TimerHandle[timer_num].handle, TIM_FLAG_UPDATE) == SET) diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp index c6b22fd441..8aaa1dbab4 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp @@ -142,11 +142,6 @@ uint32_t HAL_timer_get_count(const uint8_t timer_num) { return __HAL_TIM_GetCounter(&timerConfig[timer_num].timerdef); } -void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - void HAL_timer_isr_prologue(const uint8_t timer_num) { if (__HAL_TIM_GET_FLAG(&timerConfig[timer_num].timerdef, TIM_FLAG_UPDATE) == SET) { __HAL_TIM_CLEAR_FLAG(&timerConfig[timer_num].timerdef, TIM_FLAG_UPDATE); diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h index a97bad75fb..65bf5700e9 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h @@ -96,8 +96,6 @@ void HAL_timer_disable_interrupt(const uint8_t timer_num); void HAL_timer_set_compare(const uint8_t timer_num, const uint32_t compare); hal_timer_t HAL_timer_get_compare(const uint8_t timer_num); uint32_t HAL_timer_get_count(const uint8_t timer_num); -void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks); - void HAL_timer_isr_prologue(const uint8_t timer_num); #define HAL_timer_isr_epilogue(TIMER_NUM) diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h index bef5e5a914..7a50b04c2d 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h @@ -100,11 +100,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { return 0; } -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - void HAL_timer_enable_interrupt(const uint8_t timer_num); void HAL_timer_disable_interrupt(const uint8_t timer_num); bool HAL_timer_interrupt_enabled(const uint8_t timer_num); diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h index 5fed19e313..b44c310156 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h @@ -102,11 +102,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { return 0; } -FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { - const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; - if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); -} - void HAL_timer_enable_interrupt(const uint8_t timer_num); void HAL_timer_disable_interrupt(const uint8_t timer_num); bool HAL_timer_interrupt_enabled(const uint8_t timer_num);