Skip to content

Commit 91e826d

Browse files
committed
Replace HAL_GetTick
1 parent 2d0e5f0 commit 91e826d

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

targets/TARGET_STM/hal_tick_16b.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ void timer_oc_irq_handler(void)
5757
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC2);
5858
uint32_t val = __HAL_TIM_GET_COUNTER(&TimMasterHandle);
5959
if ((val - PreviousVal) >= HAL_TICK_DELAY) {
60-
// Increment HAL variable
61-
HAL_IncTick();
6260
// Prepare next interrupt
6361
__HAL_TIM_SET_COMPARE(&TimMasterHandle, TIM_CHANNEL_2, val + HAL_TICK_DELAY);
6462
PreviousVal = val;

targets/TARGET_STM/hal_tick_32b.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
extern TIM_HandleTypeDef TimMasterHandle;
2424

25-
extern void HAL_IncTick(void);
26-
2725
volatile uint32_t PreviousVal = 0;
2826

2927
void us_ticker_irq_handler(void);
@@ -44,8 +42,6 @@ void timer_irq_handler(void)
4442
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC2);
4543
uint32_t val = __HAL_TIM_GET_COUNTER(&TimMasterHandle);
4644
if ((val - PreviousVal) >= HAL_TICK_DELAY) {
47-
// Increment HAL variable
48-
HAL_IncTick();
4945
// Prepare next interrupt
5046
__HAL_TIM_SET_COMPARE(&TimMasterHandle, TIM_CHANNEL_2, val + HAL_TICK_DELAY);
5147
PreviousVal = val;

targets/TARGET_STM/stm_common.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "hal/us_ticker_api.h"
2+
3+
// Overwrite default HAL function
4+
uint32_t HAL_GetTick()
5+
{
6+
return ticker_read_us(get_us_ticker_data()) / 1000;
7+
}

0 commit comments

Comments
 (0)