File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -44,14 +44,16 @@ uint32_t us_ticker_read()
44
44
void us_ticker_set_interrupt (timestamp_t timestamp )
45
45
{
46
46
TimMasterHandle .Instance = TIM_MST ;
47
+ // disable IT while we are handling the correct timestamp
48
+ __HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC1 );
47
49
// Set new output compare value
48
50
__HAL_TIM_SET_COMPARE (& TimMasterHandle , TIM_CHANNEL_1 , (uint32_t )timestamp );
49
- // Enable IT
50
- __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC1 );
51
51
// Check if timestamp has already passed, and if so, set the event immediately
52
52
if ((int32_t )(timestamp - TIM_MST -> CNT ) <= 0 ) {
53
53
LL_TIM_GenerateEvent_CC1 (TimMasterHandle .Instance );
54
54
}
55
+ // Enable IT
56
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC1 );
55
57
}
56
58
57
59
void us_ticker_disable_interrupt (void )
You can’t perform that action at this time.
0 commit comments