mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #5147 from 0xc0170/fix_deepsleep_tests
Test: deepsleep() API replacementpull/4955/head
commit
84f2d089f4
|
@ -59,7 +59,10 @@ void lp_timeout_1s_deepsleep(void)
|
|||
*/
|
||||
timer.start();
|
||||
lpt.attach(&cb_done, 1);
|
||||
deepsleep();
|
||||
/* Make sure deepsleep is allowed, to go to deepsleep */
|
||||
bool deep_sleep_allowed = sleep_manager_can_deep_sleep();
|
||||
TEST_ASSERT_TRUE_MESSAGE(deep_sleep_allowed, "Deep sleep should be allowed");
|
||||
sleep();
|
||||
while (!complete);
|
||||
|
||||
/* It takes longer to wake up from deep sleep */
|
||||
|
@ -75,6 +78,8 @@ void lp_timeout_1s_sleep(void)
|
|||
|
||||
sleep_manager_lock_deep_sleep();
|
||||
lpt.attach(&cb_done, 1);
|
||||
bool deep_sleep_allowed = sleep_manager_can_deep_sleep();
|
||||
TEST_ASSERT_FALSE_MESSAGE(deep_sleep_allowed, "Deep sleep should be disallowed");
|
||||
sleep();
|
||||
while (!complete);
|
||||
sleep_manager_unlock_deep_sleep();
|
||||
|
|
|
@ -104,7 +104,10 @@ void lp_ticker_1s_deepsleep()
|
|||
lp_timer.reset();
|
||||
lp_timer.start();
|
||||
ticker_insert_event(lp_ticker_data, &delay_event, delay_ts, (uint32_t)&delay_event);
|
||||
deepsleep();
|
||||
/* Make sure deepsleep is allowed, to go to deepsleep */
|
||||
bool deep_sleep_allowed = sleep_manager_can_deep_sleep();
|
||||
TEST_ASSERT_TRUE_MESSAGE(deep_sleep_allowed, "Deep sleep should be allowed");
|
||||
sleep();
|
||||
while (!complete);
|
||||
lp_timer.stop();
|
||||
|
||||
|
@ -124,6 +127,8 @@ void lp_ticker_1s_sleep()
|
|||
sleep_manager_lock_deep_sleep();
|
||||
timer.reset();
|
||||
timer.start();
|
||||
bool deep_sleep_allowed = sleep_manager_can_deep_sleep();
|
||||
TEST_ASSERT_FALSE_MESSAGE(deep_sleep_allowed, "Deep sleep should be disallowed");
|
||||
ticker_insert_event(lp_ticker_data, &delay_event, delay_ts, (uint32_t)&delay_event);
|
||||
sleep();
|
||||
while (!complete);
|
||||
|
|
Loading…
Reference in New Issue