We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 458e726 commit b2aa2ddCopy full SHA for b2aa2dd
TESTS/mbed_hal/common_tickers/main.cpp
@@ -52,6 +52,7 @@ unsigned int ticker_overflow_delta;
52
uint32_t count_ticks(uint32_t cycles, uint32_t step)
53
{
54
register uint32_t reg_cycles = cycles;
55
+ const ticker_info_t* p_ticker_info = intf->get_info();
56
57
core_util_critical_section_enter();
58
@@ -65,7 +66,10 @@ uint32_t count_ticks(uint32_t cycles, uint32_t step)
65
66
67
core_util_critical_section_exit();
68
- return (stop - start);
69
+ if ( stop > start)
70
+ return (stop - start);
71
+ else
72
+ return (((1 << p_ticker_info->bits) - start) + stop);
73
}
74
75
void ticker_event_handler_stub(const ticker_data_t * const ticker)
0 commit comments