File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ void us_ticker_set_interrupt(timestamp_t timestamp)
152
152
*/
153
153
uint32_t current_time = us_ticker_read ();
154
154
uint32_t delta = timestamp - current_time ;
155
+ /* Note: The case of delta <= 0 is handled in MBED upper layer */
155
156
oc_int_part = (delta - 1 ) >> 16 ;
156
157
if ( ((delta - 1 ) & 0xFFFF ) >= 0x8000 &&
157
158
__HAL_TIM_GET_FLAG (& TimMasterHandle , TIM_FLAG_CC1 ) == SET ) {
@@ -169,6 +170,9 @@ void us_ticker_set_interrupt(timestamp_t timestamp)
169
170
170
171
void us_ticker_fire_interrupt (void )
171
172
{
173
+ /* When firing the event, the number of 16 bits counter wrap-ups (oc_int)
174
+ * must be re-initialized */
175
+ oc_int_part = 0 ;
172
176
HAL_TIM_GenerateEvent (& TimMasterHandle , TIM_EVENTSOURCE_CC1 );
173
177
}
174
178
You can’t perform that action at this time.
0 commit comments