From 60a3a4e5241b232bd6e89a2a5207b6539422a592 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sun, 25 Sep 2022 09:09:17 -0700 Subject: [PATCH] Fix overflow issue causing common tickers test to intermittently fail (#57) * Fix overflow issue causing common tickers test to intermittently fail (#44) * Tabs -> spaces --- hal/tests/TESTS/mbed_hal/common_tickers/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hal/tests/TESTS/mbed_hal/common_tickers/main.cpp b/hal/tests/TESTS/mbed_hal/common_tickers/main.cpp index 442eb0155f..96f940a5bb 100644 --- a/hal/tests/TESTS/mbed_hal/common_tickers/main.cpp +++ b/hal/tests/TESTS/mbed_hal/common_tickers/main.cpp @@ -221,9 +221,9 @@ void ticker_interrupt_test(void) uint8_t run_count = 0; const ticker_info_t *p_ticker_info = intf->get_info(); - overflow_protect(); - for (uint32_t i = 0; i < (sizeof(ticker_timeout) / sizeof(uint32_t)); i++) { + // If needed, delay until we can run the test without overflowing the ticker. + overflow_protect(); /* Skip timeout if less than max allowed execution time of set_interrupt() - 20 us */ if (TICKS_TO_US(ticker_timeout[i], p_ticker_info->frequency) < (MAX_FUNC_EXEC_TIME_US + DELTA_FUNC_EXEC_TIME_US)) {