Skip to content

Merge feature-hal-spec-ticker to master #6995

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

Closed
wants to merge 102 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
5f40164
Add documentation for the HAL Ticker API
c1728p9 Sep 19, 2017
22d5ca2
Add tests for ticker HAL API.
mprse Oct 2, 2017
43961ee
Add minor modifications of lp/us tickers tests desctiption in ticker …
mprse Oct 30, 2017
c1d22aa
Disable boards which does not fulfil new ticker standards.
mprse Dec 19, 2017
166df09
Add DEVICE_RTC symbol check in RTC source files for NCS36510 target.
mprse Jan 8, 2018
90260a6
Skip higher level ticker tests for targets with stale ticker target s…
mprse Jan 9, 2018
c01d658
Modify requirement for the ticker_init function.
mprse Jan 19, 2018
fa7a195
Modify ticker_init_test() to be consistent with the new requirement.
mprse Jan 19, 2018
79a5682
Provide fix to the implementation of ticker_overflow_test test case.
mprse Jan 19, 2018
b6e5069
Add free function to lp/us ticker HAL API
Jan 22, 2018
c55b331
Add lp/us ticker free() function implementation for NRF5
Jan 15, 2018
423d77d
Enable ticker support for K64F board.
mprse Feb 1, 2018
faf8177
Adapt K64F us ticker driver to the new standards.
mprse Feb 1, 2018
ea29e12
Adapt K64F lp ticker driver to the new standards.
mprse Feb 2, 2018
054c57f
lp_us_tickers test - provide counter overflow protection
mprse Feb 8, 2018
758c5cb
lp_us_tickers test - add tolerance to interrupt time.
mprse Feb 8, 2018
8347ed9
lp_us_tickers test - fix count_ticks() function to give the same resu…
mprse Feb 13, 2018
c799f88
Skip higher level ticker tests for targets with stale ticker target s…
mprse Feb 22, 2018
68b9ba6
lp_ticker test - provide lp ticker glitch test case
mprse Feb 26, 2018
91855e4
Rename DEVICE_LOWPOWERTIMER to DEVICE_LPTICKER
bulislaw Mar 13, 2018
d07777d
Disable Maxim boards as LP_TICKER is used in RTC and they don't respe…
bulislaw Mar 14, 2018
8031140
Make sure LPTICKER symbols are not used for builds without it for Nordic
bulislaw Mar 20, 2018
56107f7
Don't use tickless if LPTICKER is not present
bulislaw Mar 20, 2018
ced30f8
Disable platfroms that fail without LPTICKER
bulislaw Mar 22, 2018
d266028
Remove nrf51_dk from supported platform
bulislaw Mar 23, 2018
f36eba6
Rename lp_us tests to common and hf to microsecond
bulislaw Mar 23, 2018
f9b2a72
Fix rebase error
bulislaw Mar 27, 2018
adb4589
lp_us_tickers test: fix `increment test` for slow boards
mprse Feb 27, 2018
e89980f
lp_us_tickers test: fix overflow protection
mprse Feb 27, 2018
ee38c46
lp_us_tickers test: call overflow_protect function in test functions …
mprse Mar 27, 2018
dfc7aee
lp_us_tickers test: provide minor fixes after review
mprse Mar 9, 2018
ade7322
Re-implement RTC for Silicon Labs targets
stevew817 Mar 26, 2018
c753ea5
Re-implement us_ticker and lp_ticker for Silicon Labs targets
stevew817 Mar 27, 2018
af332ff
Update STM32 16 bits us_tickers in line with new mbed HAL
LMESTM Mar 26, 2018
6f2b738
Make us_ticker common between 16 and 32 bits counters
LMESTM Mar 26, 2018
00e7959
Activate USTICKER device feature for all STM32 targets
LMESTM Mar 26, 2018
5aa7e26
tests-mbed_hal-lp_ticker : increase time before deep sleep
jeromecoutant Apr 9, 2018
7bb4a0b
Restore ticker state after each test
c1728p9 Apr 6, 2018
1968007
tests-mbed_hal-lp_ticker: Add overflow protection.
mprse Apr 10, 2018
7a84e05
Implementation of USTICKER feature for Renesas mbed boards
TomoYamanaka Mar 28, 2018
677e798
tests-mbed_hal-common_tickers_freq : use unsigned long
jeromecoutant Apr 9, 2018
704c33e
tests-mbed_hal-common_tickers_freq : correct overflowCounter value
jeromecoutant Apr 9, 2018
c79009a
Rename LOWPOWERTIMER to LPTICKER after merge
bulislaw Apr 19, 2018
451af7f
STM32 LPTICKER update for targets supporting LPTIMER
jeromecoutant Mar 27, 2018
2b93dca
LPTICKER targets json update for STM32 supporting LPTIMER
jeromecoutant Mar 27, 2018
9635d3f
STM32 LPTICKER : read counter
jeromecoutant Apr 17, 2018
314a35e
#6536 rebase correction
jeromecoutant Apr 23, 2018
e7e66fb
STM32 RTC Init minor update
jeromecoutant Apr 24, 2018
64a4a48
STM32 LPTICKER : enable all STM32 targets supporting the feature
jeromecoutant Mar 28, 2018
334ca4c
STM32 LPTICKER : clean include file
jeromecoutant Mar 28, 2018
e22d9a1
STM32 LPTICKER update for targets supporting RTC
jeromecoutant Apr 24, 2018
927aa7a
NRF5 - make us ticker to be driven by high speed 1MHz timer
mprse Nov 30, 2017
0953515
Enable us/lp ticker support for NRF51_DK board
mprse Jan 18, 2018
7f3dcdb
Update lp ticker to be consistent with the new standards.
mprse Jan 19, 2018
e011328
tests-mbed_drivers-timerevent: perform test only if USTICKER support …
mprse Mar 6, 2018
65726f1
tests-mbed_hal-lp_ticker: run sleep test only if SLEEP support is en…
mprse Mar 6, 2018
0b116f1
tests-mbed_drivers-lp_ticker: Adapt tolerance for new Ticker driver
mprse Mar 9, 2018
5490e32
tests-mbed_drivers-timer: Adapt tolerance for new Ticker driver
mprse Mar 9, 2018
23d64c4
Rename DEVICE_LOWPOWERTIMER to DEVICE_LPTICKER.
mprse Mar 28, 2018
bef3185
tests-mbed_hal-common_tickers: increase overflow protection limit
mprse Apr 23, 2018
2aa7f4e
mbed_ticker_api remove specific case for 32768 in favor of all freque…
May 2, 2018
e9bc33e
Changed struct position to try to maintain binary compatibility
May 2, 2018
9437dfe
Updated types according to header changes
May 2, 2018
2c305e1
Disable failig Nordic targets
bulislaw May 15, 2018
8affed7
Disable MAX targets failig to build
bulislaw May 16, 2018
5608cfe
Move common_rtc.c and us_ticker.h files to the valid directory.
mprse May 17, 2018
f0a9da9
Enable support for NRF51 boards.
mprse May 17, 2018
53778c7
tests-events-queue: modify tolerance to percentage form
mprse May 17, 2018
cbbb098
Disable us ticker in deep-sleep mode.
mprse May 17, 2018
c6ead07
tests-mbed_drivers-timerevent: Disable deep-sleep mode in TestTimerEv…
mprse May 17, 2018
2227c03
tests-mbed_drivers-lp_ticker: increase tolerance for NRF51_DK
mprse May 17, 2018
480e0be
Enable support for NRF51 boards.
mprse May 18, 2018
f4c0035
tests-mbed_hal-common_tickers: disable os tick while running test cases
mprse May 18, 2018
5b1d8ba
LPC1768: Enable usticker
mmahadevan108 May 17, 2018
50c2d9b
KL05, KL25, KL26, KL46: Enable usticker
mmahadevan108 May 17, 2018
191031d
MCUXpresso: Update Low Power Ticker
mmahadevan108 Mar 27, 2018
068c91c
MCUXpresso: Update the usticker implementation
mmahadevan108 May 15, 2018
79d91c9
MCUXpresso: Enable usticker for LPC546XX and LPC54114
mmahadevan108 May 16, 2018
356c082
MCUXpresso: Enable usticker on MIMXRT1050_EVK
mmahadevan108 May 16, 2018
b810cf9
Fix us_ticker.c to support "USTICKER"
May 19, 2018
5a2d0af
ADI: Enable "USTICKER" feature for EV_COG_AD3029LZ and EV_COG_AD4050LZ
May 19, 2018
b0026a8
Change LPTICKER spec to allow clock freq starting at 4kHz
bulislaw May 23, 2018
d41aa09
KW41Z: Update usticker to use TPM instead of LPTMR for ticker
mmahadevan108 May 17, 2018
964c3e5
KL43Z: Update usticker to use TPM instead of LPTMR for ticker
mmahadevan108 May 18, 2018
1ed38a4
KL27Z: Update usticker to use TPM instead of LPTMR for ticker
mmahadevan108 May 18, 2018
9c0ad93
KW41Z, KL43Z, KL27Z: Enable LPTICKER
mmahadevan108 May 18, 2018
dd37067
MIMXRT1050_EVK: Update lpticker implementation
mmahadevan108 May 17, 2018
0352cfa
NRF52_DK: use new ticker driver designed for NRF51_DK
mprse May 21, 2018
dc6a81c
NRF52_DK: Enable lp ticker and us ticker support
mprse May 21, 2018
eb16101
tests-mbed_hal-common_tickers: fix bug in ticker increment test case
mprse May 21, 2018
6698488
tests-mbed_drivers-timerevent: increase tolerance for NRF52_DK
mprse May 21, 2018
64a8499
tests-mbed_drivers-lp_timer: modify tolerance to percentage form
mprse May 21, 2018
51997e8
tests-mbed_hal-flash: Remove 5% extra tolerance for NRF52_DK
mprse May 21, 2018
babea30
tests-mbed_hal-flash: optimieze time_cpu_cycles() function
mprse May 21, 2018
2559be3
NRF52_DK: disable us ticker in deep-sleep mode
mprse May 21, 2018
ebe7985
Enable us lp ticker support for entire MCU_NRF52832 family
mprse May 23, 2018
b2030cf
mbed-os v5.9 USTICKER implementation
jessexm May 17, 2018
8251a56
mbed-os v5.9 LPTICKER implementation
jessexm May 17, 2018
a632235
Adding usticker to MTB_ODIN
May 23, 2018
b0a1e5e
NRF52840_DK: Enable lp us ticker support
mprse May 24, 2018
7800d82
Make common_rtc.c compatible with SDK 14.2 and move it common dir
mprse May 23, 2018
9fdb5c2
Rename new occurrences of LOWPOWERTIMER to LPTICKER
bulislaw May 24, 2018
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
9 changes: 8 additions & 1 deletion TESTS/events/queue/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@
#include "unity.h"
#include "utest.h"

#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#endif

using namespace utest::v1;

// Assume that tolerance is 5% of measured time.
#define DELTA(ms) (ms / 20)

// TEST_EQUEUE_SIZE was reduced below 1024B to fit this test to devices with small RAM (RAM <= 16kB)
// additionally TEST_EQUEUE_SIZE was expressed in EVENTS_EVENT_SIZE to increase readability
// (for more details about EVENTS_EVENT_SIZE see EventQueue constructor)
Expand Down Expand Up @@ -89,7 +96,7 @@ SIMPLE_POSTS_TEST(0)


void time_func(Timer *t, int ms) {
TEST_ASSERT_INT_WITHIN(5, ms, t->read_ms());
TEST_ASSERT_INT_WITHIN(DELTA(ms), ms, t->read_ms());
t->reset();
}

Expand Down
3 changes: 3 additions & 0 deletions TESTS/events/timing/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

using namespace utest::v1;

#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#endif

// Test delay
#ifndef TEST_EVENTS_TIMING_TIME
Expand Down
13 changes: 7 additions & 6 deletions TESTS/mbed_drivers/lp_ticker/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "unity/unity.h"


#if !DEVICE_LOWPOWERTIMER
#if !DEVICE_LPTICKER
#error [NOT_SUPPORTED] Low power ticker not supported for this target
#endif

Expand All @@ -33,8 +33,9 @@ static const int test_timeout = 10;
/* Due to poor accuracy of LowPowerTicker on many platforms
there is no sense to tune tolerance value as it was in Ticker tests.

Tolerance value is set to 2000us to cover this diversity */
#define TOLERANCE_US 2000
Tolerance value is set to 600us for measurement inaccuracy + 5% tolerance
for LowPowerTicker. */
#define TOLERANCE_US(DELAY) (600 + DELAY / 20)


volatile uint32_t ticker_callback_flag;
Expand Down Expand Up @@ -117,7 +118,7 @@ void test_multi_call_time(void)
while(!ticker_callback_flag);
time_diff = gtimer.read_us();

TEST_ASSERT_UINT32_WITHIN(TOLERANCE_US, MULTI_TICKER_TIME_MS * 1000, time_diff);
TEST_ASSERT_UINT32_WITHIN(TOLERANCE_US(MULTI_TICKER_TIME_MS * 1000), MULTI_TICKER_TIME_MS * 1000, time_diff);
}
}

Expand Down Expand Up @@ -167,7 +168,7 @@ void test_attach_time(void)
ticker.detach();
const int time_diff = gtimer.read_us();

TEST_ASSERT_UINT64_WITHIN(TOLERANCE_US, DELAY_US, time_diff);
TEST_ASSERT_UINT64_WITHIN(TOLERANCE_US(DELAY_US), DELAY_US, time_diff);
}

/** Test single callback time via attach_us
Expand All @@ -189,7 +190,7 @@ void test_attach_us_time(void)
ticker.detach();
const int time_diff = gtimer.read_us();

TEST_ASSERT_UINT64_WITHIN(TOLERANCE_US, DELAY_US, time_diff);
TEST_ASSERT_UINT64_WITHIN(TOLERANCE_US(DELAY_US), DELAY_US, time_diff);
}

// Test cases
Expand Down
4 changes: 2 additions & 2 deletions TESTS/mbed_drivers/lp_timeout/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#if !DEVICE_LOWPOWERTIMER
#error [NOT_SUPPORTED] Low power timer not supported for this target
#if !DEVICE_LPTICKER
#error [NOT_SUPPORTED] Low power timer not supported for this target
#endif

#include "mbed.h"
Expand Down
101 changes: 49 additions & 52 deletions TESTS/mbed_drivers/lp_timer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "rtos.h"
#include "hal/us_ticker_api.h"

#if !DEVICE_LOWPOWERTIMER
#if !DEVICE_LPTICKER
#error [NOT_SUPPORTED] test not supported
#endif

Expand All @@ -35,26 +35,21 @@ extern uint32_t SystemCoreClock;
* timer we need to adjust delta.
*/

/* Macro to define delta based on CPU clock frequency.
/*
* Define tolerance as follows:
* tolerance = 500 us + 5% of measured time
*
* Note that some extra time is counted by the timer.
* Additional time is caused by the function calls and
* additional operations performed by wait and
* stop functions before in fact timer is stopped. This may
* add additional time to the counted result.
* e.g.
* 1 ms delay: tolerance = 550 us
* 10 ms delay: tolerance = 1000 us
* 100 ms delay: tolerance = 5500 us
* 1000 ms delay: tolerance = 50500 us
*
* To take in to account this extra time we introduce DELTA
* value based on CPU clock (speed):
* DELTA = TOLERANCE_FACTOR / SystemCoreClock * US_FACTOR
*
* e.g.
* For K64F DELTA = (80000 / 120000000) * 1000000 = 666[us]
* For NUCLEO_F070RB DELTA = (80000 / 48000000) * 1000000 = 1666[us]
* For NRF51_DK DELTA = (80000 / 16000000) * 1000000 = 5000[us]
*
* As low power timer cannot be too much accurate, this DELTA should not be more precise than 500us,
* which corresponds to a maximum CPU clock around 130MHz
*/
* */
#define DELTA_US(delay_ms) (500 + delay_ms * US_PER_MSEC / 20)
#define DELTA_MS(delay_ms) (1 + (delay_ms * US_PER_MSEC / 20 / US_PER_MSEC))
#define DELTA_S(delay_ms) (0.000500f + (((float)delay_ms) / MSEC_PER_SEC / 20))

#define US_PER_SEC 1000000
#define US_PER_MSEC 1000
#define TOLERANCE_FACTOR 80000.0f
Expand Down Expand Up @@ -122,10 +117,10 @@ void test_lptimer_time_accumulation()
lp_timer.stop();

/* Check results - totally 10 ms have elapsed. */
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(1), 0.010f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(1), 10, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(1), 10000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(1), 10000, lp_timer.read_high_resolution_us());
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(10), 0.010f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(10), 10, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(10), 10000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(10), 10000, lp_timer.read_high_resolution_us());

/* Wait 50 ms - this is done to show that time elapsed when
* the timer is stopped does not have influence on the
Expand All @@ -144,10 +139,10 @@ void test_lptimer_time_accumulation()
lp_timer.stop();

/* Check results - totally 30 ms have elapsed. */
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(2), 0.030f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(2), 30, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(2), 30000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(2), 30000, lp_timer.read_high_resolution_us());
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(30), 0.030f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(30), 30, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(30), 30000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(30), 30000, lp_timer.read_high_resolution_us());

/* Wait 50 ms - this is done to show that time elapsed when
* the timer is stopped does not have influence on the
Expand All @@ -165,10 +160,10 @@ void test_lptimer_time_accumulation()
lp_timer.stop();

/* Check results - totally 60 ms have elapsed. */
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(3), 0.060f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(3), 60, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(3), 60000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(3), 60000, lp_timer.read_high_resolution_us());
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(60), 0.060f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(60), 60, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(60), 60000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(60), 60000, lp_timer.read_high_resolution_us());

/* Wait 50 ms - this is done to show that time elapsed when
* the timer is stopped does not have influence on the
Expand All @@ -187,10 +182,10 @@ void test_lptimer_time_accumulation()
lp_timer.stop();

/* Check results - totally 1060 ms have elapsed. */
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(4), 1.060f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(4), 1060, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(4), 1060000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(4), 1060000, lp_timer.read_high_resolution_us());
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(1060), 1.060f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(1060), 1060, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(1060), 1060000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(1060), 1060000, lp_timer.read_high_resolution_us());
}

/* This test verifies if reset() function resets the
Expand All @@ -216,10 +211,10 @@ void test_lptimer_reset()
lp_timer.stop();

/* Check results - totally 10 ms elapsed. */
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(1), 0.010f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(1), 10, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(1), 10000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(1), 10000, lp_timer.read_high_resolution_us());
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(10), 0.010f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(10), 10, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(10), 10000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(10), 10000, lp_timer.read_high_resolution_us());

/* Reset the timer - previous measured time should be lost now. */
lp_timer.reset();
Expand All @@ -234,10 +229,10 @@ void test_lptimer_reset()
lp_timer.stop();

/* Check results - 20 ms elapsed since the reset. */
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(1), 0.020f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(1), 20, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(1), 20000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(1), 20000, lp_timer.read_high_resolution_us());
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(20), 0.020f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(20), 20, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(20), 20000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(20), 20000, lp_timer.read_high_resolution_us());
}

/* This test verifies if calling start() for already
Expand Down Expand Up @@ -267,10 +262,10 @@ void test_lptimer_start_started_timer()
lp_timer.stop();

/* Check results - 30 ms have elapsed since the first start. */
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(2), 0.030f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(2), 30, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(2), 30000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(2), 30000, lp_timer.read_high_resolution_us());
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(30), 0.030f, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(30), 30, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(30), 30000, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(30), 30000, lp_timer.read_high_resolution_us());
}

/* This test verifies low power timer float operator.
Expand All @@ -294,7 +289,7 @@ void test_lptimer_float_operator()
lp_timer.stop();

/* Check result - 10 ms elapsed. */
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(1), 0.010f, (float )(lp_timer));
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(10), 0.010f, (float )(lp_timer));
}

/* This test verifies if time counted by the low power timer is
Expand All @@ -310,6 +305,8 @@ void test_lptimer_time_measurement()
{
LowPowerTimer lp_timer;

const int delta_ms = (wait_val_us / US_PER_MSEC);

/* Start the timer. */
lp_timer.start();

Expand All @@ -320,10 +317,10 @@ void test_lptimer_time_measurement()
lp_timer.stop();

/* Check results - wait_val_us us have elapsed. */
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(1), (float )wait_val_us / 1000000, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(1), wait_val_us / 1000, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(1), wait_val_us, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(1), wait_val_us, lp_timer.read_high_resolution_us());
TEST_ASSERT_FLOAT_WITHIN(DELTA_S(delta_ms), (float )wait_val_us / 1000000, lp_timer.read());
TEST_ASSERT_INT32_WITHIN(DELTA_MS(delta_ms), wait_val_us / 1000, lp_timer.read_ms());
TEST_ASSERT_INT32_WITHIN(DELTA_US(delta_ms), wait_val_us, lp_timer.read_us());
TEST_ASSERT_UINT64_WITHIN(DELTA_US(delta_ms), wait_val_us, lp_timer.read_high_resolution_us());
}

utest::v1::status_t test_setup(const size_t number_of_cases)
Expand Down
4 changes: 4 additions & 0 deletions TESTS/mbed_drivers/race_test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
#error [NOT_SUPPORTED] test not supported for single threaded enviroment
#endif

#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#endif

using namespace utest::v1;

#define TEST_STACK_SIZE 512
Expand Down
2 changes: 1 addition & 1 deletion TESTS/mbed_drivers/rtc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "rtos.h"
#include "rtc_api.h"

#if !DEVICE_RTC
#if !DEVICE_RTC || !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#endif

Expand Down
3 changes: 3 additions & 0 deletions TESTS/mbed_drivers/ticker/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#include "utest/utest.h"
#include "unity/unity.h"

#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#endif

using utest::v1::Case;

Expand Down
2 changes: 1 addition & 1 deletion TESTS/mbed_drivers/timeout/timeout_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ void test_sleep(void)
timeout.detach();
}

#if DEVICE_LOWPOWERTIMER
#if DEVICE_LPTICKER
/** Template for tests: timeout during deepsleep
*
* Test timeout during deepsleep
Expand Down
Loading