File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed
Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -43,8 +43,18 @@ void lp_timeout_1s_deepsleep(void)
4343{
4444 complete = false ;
4545
46- /*
47- * We use here lp_ticker_read() instead of us_ticker_read() for start and
46+ /*
47+ * Since deepsleep() may shut down the UART peripheral, we wait for 10ms
48+ * to allow for hardware serial buffers to completely flush.
49+
50+ * This should be replaced with a better function that checks if the
51+ * hardware buffers are empty. However, such an API does not exist now,
52+ * so we'll use the wait_ms() function for now.
53+ */
54+ wait_ms (10 );
55+
56+ /*
57+ * We use here lp_ticker_read() instead of us_ticker_read() for start and
4858 * end because the microseconds timer might be disable during deepsleep.
4959 */
5060 timestamp_t start = lp_ticker_read ();
Original file line number Diff line number Diff line change @@ -65,12 +65,22 @@ void lp_ticker_1s_deepsleep()
6565 complete = false ;
6666 uint32_t delay_ts;
6767
68+ /*
69+ * Since deepsleep() may shut down the UART peripheral, we wait for 10ms
70+ * to allow for hardware serial buffers to completely flush.
71+
72+ * This should be replaced with a better function that checks if the
73+ * hardware buffers are empty. However, such an API does not exist now,
74+ * so we'll use the wait_ms() function for now.
75+ */
76+ wait_ms (10 );
77+
6878 ticker_set_handler (lp_ticker_data, cb_done);
6979 ticker_remove_event (lp_ticker_data, &delay_event);
7080 delay_ts = lp_ticker_read () + 1000000 ;
7181
72- /*
73- * We use here lp_ticker_read() instead of us_ticker_read() for start and
82+ /*
83+ * We use here lp_ticker_read() instead of us_ticker_read() for start and
7484 * end because the microseconds timer might be disable during deepsleep.
7585 */
7686 timestamp_t start = lp_ticker_read ();
You can’t perform that action at this time.
0 commit comments