Skip to content

Commit 24203fc

Browse files
committed
Fix compilation issue for targets without LPTICKER or USTICKER
1 parent d4db0f3 commit 24203fc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

TESTS/mbed_hal/sleep_manager/main.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ using utest::v1::Case;
3434
using utest::v1::Specification;
3535
using utest::v1::Harness;
3636

37+
#if DEVICE_LPTICKER
3738
/* Make sure there are enough ticks to cope with more than SLEEP_DURATION_US sleep
3839
* without hitting the wrap-around.
3940
*/
@@ -53,6 +54,7 @@ void wraparound_lp_protect(void)
5354

5455
while (get_lp_ticker_data()->interface->read() > (max_count - delta_ticks));
5556
}
57+
#endif
5658

5759
void test_lock_unlock()
5860
{
@@ -82,8 +84,6 @@ void test_lock_eq_ushrt_max()
8284
TEST_ASSERT_TRUE(sleep_manager_can_deep_sleep());
8385
}
8486

85-
#if DEVICE_LPTICKER
86-
#if DEVICE_USTICKER
8787
utest::v1::status_t testcase_setup(const Case *const source, const size_t index_of_case)
8888
{
8989
// Suspend the RTOS kernel scheduler to prevent interference with duration of sleep.
@@ -94,12 +94,11 @@ utest::v1::status_t testcase_setup(const Case *const source, const size_t index_
9494
// Suspend the low power ticker wrapper to prevent interference with deep sleep lock.
9595
lp_ticker_wrapper_suspend();
9696
#endif
97+
lp_ticker_init();
9798
#endif
98-
99+
#if DEVICE_USTICKER
99100
// Make sure HAL tickers are initialized.
100101
us_ticker_init();
101-
#if DEVICE_LPTICKER
102-
lp_ticker_init();
103102
#endif
104103

105104
return utest::v1::greentea_case_setup_handler(source, index_of_case);
@@ -117,6 +116,8 @@ utest::v1::status_t testcase_teardown(const Case *const source, const size_t pas
117116
return utest::v1::greentea_case_teardown_handler(source, passed, failed, failure);
118117
}
119118

119+
#if DEVICE_LPTICKER
120+
#if DEVICE_USTICKER
120121
/* This test is based on the fact that the high-speed clocks are turned off
121122
* in deep sleep mode but remain on in the ordinary sleep mode. Low-speed
122123
* clocks stay on for both sleep and deep sleep modes.

0 commit comments

Comments
 (0)