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)
43
43
{
44
44
complete = false ;
45
45
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
48
58
* end because the microseconds timer might be disable during deepsleep.
49
59
*/
50
60
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()
65
65
complete = false ;
66
66
uint32_t delay_ts;
67
67
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
+
68
78
ticker_set_handler (lp_ticker_data, cb_done);
69
79
ticker_remove_event (lp_ticker_data, &delay_event);
70
80
delay_ts = lp_ticker_read () + 1000000 ;
71
81
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
74
84
* end because the microseconds timer might be disable during deepsleep.
75
85
*/
76
86
timestamp_t start = lp_ticker_read ();
You can’t perform that action at this time.
0 commit comments