Skip to content

Commit 8c785e5

Browse files
committed
[BLUEPILL_F103C8] Sleep code refactor
1 parent 6b8ff8f commit 8c785e5

File tree

1 file changed

+15
-0
lines changed
  • hal/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8

1 file changed

+15
-0
lines changed

hal/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/hal_tick.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,21 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
138138
return HAL_OK;
139139
}
140140

141+
void HAL_SuspendTick(void)
142+
{
143+
TimMasterHandle.Instance = TIM_MST;
144+
145+
// Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
146+
__HAL_TIM_DISABLE_IT(&TimMasterHandle, (TIM_IT_CC2 | TIM_IT_UPDATE));
147+
}
148+
149+
void HAL_ResumeTick(void)
150+
{
151+
TimMasterHandle.Instance = TIM_MST;
152+
153+
// Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
154+
__HAL_TIM_ENABLE_IT(&TimMasterHandle, (TIM_IT_CC2 | TIM_IT_UPDATE));
155+
}
141156
/**
142157
* @}
143158
*/

0 commit comments

Comments
 (0)