Skip to content

Commit 96b338d

Browse files
authored
Merge pull request #2221 from zgoda/BLUEPILL_sleep_code_refactor
[BLUEPILL_F103C8] Sleep code refactor
2 parents 72f03ad + 093c7b9 commit 96b338d

File tree

1 file changed

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

1 file changed

+13
-0
lines changed

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

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

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

0 commit comments

Comments
 (0)