Remove obsolete HAL_timer_restrain
This commit is contained in:
parent
77efcad1df
commit
6a3207391f
@ -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 _CAT(a, ...) a ## __VA_ARGS__
|
||||||
#define HAL_timer_set_compare(timer, compare) (_CAT(TIMER_OCR_, timer) = compare)
|
#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_compare(timer) _CAT(TIMER_OCR_, timer)
|
||||||
#define HAL_timer_get_count(timer) _CAT(TIMER_COUNTER_, timer)
|
#define HAL_timer_get_count(timer) _CAT(TIMER_COUNTER_, timer)
|
||||||
|
|
||||||
|
@ -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;
|
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_enable_interrupt(const uint8_t timer_num);
|
||||||
void HAL_timer_disable_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);
|
bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
|
||||||
|
@ -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_compare(const uint8_t timer_num);
|
||||||
hal_timer_t HAL_timer_get_count(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_enable_interrupt(const uint8_t timer_num);
|
||||||
void HAL_timer_disable_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);
|
bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
|
||||||
|
@ -127,11 +127,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
|
|||||||
return 0;
|
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) {
|
FORCE_INLINE static void HAL_timer_enable_interrupt(const uint8_t timer_num) {
|
||||||
switch (timer_num) {
|
switch (timer_num) {
|
||||||
case 0: NVIC_EnableIRQ(TIMER0_IRQn); // Enable interrupt handler
|
case 0: NVIC_EnableIRQ(TIMER0_IRQn); // Enable interrupt handler
|
||||||
|
@ -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) {
|
FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) {
|
||||||
switch (timer_num) {
|
switch (timer_num) {
|
||||||
case STEP_TIMER_NUM:
|
case STEP_TIMER_NUM:
|
||||||
|
@ -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);
|
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
|
#ifdef STM32GENERIC
|
||||||
FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) {
|
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)
|
if (__HAL_TIM_GET_FLAG(&TimerHandle[timer_num].handle, TIM_FLAG_UPDATE) == SET)
|
||||||
|
@ -142,11 +142,6 @@ uint32_t HAL_timer_get_count(const uint8_t timer_num) {
|
|||||||
return __HAL_TIM_GetCounter(&timerConfig[timer_num].timerdef);
|
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) {
|
void HAL_timer_isr_prologue(const uint8_t timer_num) {
|
||||||
if (__HAL_TIM_GET_FLAG(&timerConfig[timer_num].timerdef, TIM_FLAG_UPDATE) == SET) {
|
if (__HAL_TIM_GET_FLAG(&timerConfig[timer_num].timerdef, TIM_FLAG_UPDATE) == SET) {
|
||||||
__HAL_TIM_CLEAR_FLAG(&timerConfig[timer_num].timerdef, TIM_FLAG_UPDATE);
|
__HAL_TIM_CLEAR_FLAG(&timerConfig[timer_num].timerdef, TIM_FLAG_UPDATE);
|
||||||
|
@ -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);
|
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);
|
hal_timer_t HAL_timer_get_compare(const uint8_t timer_num);
|
||||||
uint32_t HAL_timer_get_count(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);
|
void HAL_timer_isr_prologue(const uint8_t timer_num);
|
||||||
#define HAL_timer_isr_epilogue(TIMER_NUM)
|
#define HAL_timer_isr_epilogue(TIMER_NUM)
|
||||||
|
|
||||||
|
@ -100,11 +100,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
|
|||||||
return 0;
|
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_enable_interrupt(const uint8_t timer_num);
|
||||||
void HAL_timer_disable_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);
|
bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
|
||||||
|
@ -102,11 +102,6 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
|
|||||||
return 0;
|
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_enable_interrupt(const uint8_t timer_num);
|
||||||
void HAL_timer_disable_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);
|
bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
|
||||||
|
Loading…
Reference in New Issue
Block a user