Skip to content

set the tolerance to 5% if NO_SYSTICK is enabled #7070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions TESTS/mbed_drivers/timer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ extern uint32_t SystemCoreClock;
* 1000 ms delay: tolerance = 20500 us
*
* */
#define DELTA_US(delay_ms) (500 + (delay_ms) * US_PER_MSEC / 50)
#define DELTA_MS(delay_ms) (1 + ((delay_ms) * US_PER_MSEC / 50 / US_PER_MSEC))
#define DELTA_S(delay_ms) (0.000500f + (((float)(delay_ms)) / MSEC_PER_SEC / 50))
#ifdef NO_SYSTICK
#define TOLERANCE 5
#else
#define TOLERANCE 2
#endif

#define DELTA_US(delay_ms) (500 + (delay_ms) * US_PER_MSEC * TOLERANCE / 100)
#define DELTA_MS(delay_ms) (1 + (delay_ms) * TOLERANCE / 100)
#define DELTA_S(delay_ms) (0.000500f + ((float)(delay_ms)) * ((float)(TOLERANCE) / 100.f) / MSEC_PER_SEC)

#define TICKER_FREQ_1MHZ 1000000
#define TICKER_BITS 32
Expand Down