mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #3017 from bridadan/wait-before-deepsleep-test
[tests] Waiting before call to deepsleep to allow buffers to flushpull/3076/head
commit
64c527ee44
|
@ -43,8 +43,18 @@ void lp_timeout_1s_deepsleep(void)
|
||||||
{
|
{
|
||||||
complete = false;
|
complete = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We use here lp_ticker_read() instead of us_ticker_read() for start and
|
* Since deepsleep() may shut down the UART peripheral, we wait for 10ms
|
||||||
|
* to allow for hardware serial buffers to completely flush.
|
||||||
|
|
||||||
|
* This should be replaced with a better function that checks if the
|
||||||
|
* hardware buffers are empty. However, such an API does not exist now,
|
||||||
|
* so we'll use the wait_ms() function for now.
|
||||||
|
*/
|
||||||
|
wait_ms(10);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We use here lp_ticker_read() instead of us_ticker_read() for start and
|
||||||
* end because the microseconds timer might be disable during deepsleep.
|
* end because the microseconds timer might be disable during deepsleep.
|
||||||
*/
|
*/
|
||||||
timestamp_t start = lp_ticker_read();
|
timestamp_t start = lp_ticker_read();
|
||||||
|
|
|
@ -65,12 +65,22 @@ void lp_ticker_1s_deepsleep()
|
||||||
complete = false;
|
complete = false;
|
||||||
uint32_t delay_ts;
|
uint32_t delay_ts;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Since deepsleep() may shut down the UART peripheral, we wait for 10ms
|
||||||
|
* to allow for hardware serial buffers to completely flush.
|
||||||
|
|
||||||
|
* This should be replaced with a better function that checks if the
|
||||||
|
* hardware buffers are empty. However, such an API does not exist now,
|
||||||
|
* so we'll use the wait_ms() function for now.
|
||||||
|
*/
|
||||||
|
wait_ms(10);
|
||||||
|
|
||||||
ticker_set_handler(lp_ticker_data, cb_done);
|
ticker_set_handler(lp_ticker_data, cb_done);
|
||||||
ticker_remove_event(lp_ticker_data, &delay_event);
|
ticker_remove_event(lp_ticker_data, &delay_event);
|
||||||
delay_ts = lp_ticker_read() + 1000000;
|
delay_ts = lp_ticker_read() + 1000000;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We use here lp_ticker_read() instead of us_ticker_read() for start and
|
* We use here lp_ticker_read() instead of us_ticker_read() for start and
|
||||||
* end because the microseconds timer might be disable during deepsleep.
|
* end because the microseconds timer might be disable during deepsleep.
|
||||||
*/
|
*/
|
||||||
timestamp_t start = lp_ticker_read();
|
timestamp_t start = lp_ticker_read();
|
||||||
|
|
Loading…
Reference in New Issue