File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -49,9 +49,16 @@ void lp_timeout_1s_deepsleep(void)
49
49
50
50
* This should be replaced with a better function that checks if the
51
51
* hardware buffers are empty. However, such an API does not exist now,
52
- * so we'll use the wait_ms() function for now.
52
+ * so we'll use the Timer for now.
53
53
*/
54
- wait_ms (10 );
54
+ {
55
+ Timer timer;
56
+ timer.start ();
57
+ int start = timer.read_ms ();
58
+ int end = start + 10 ;
59
+ while (timer.read_ms () < end) {
60
+ }
61
+ }
55
62
56
63
/*
57
64
* We use here lp_ticker_read() instead of us_ticker_read() for start and
Original file line number Diff line number Diff line change @@ -78,9 +78,16 @@ void lp_ticker_1s_deepsleep()
78
78
79
79
* This should be replaced with a better function that checks if the
80
80
* hardware buffers are empty. However, such an API does not exist now,
81
- * so we'll use the wait_ms() function for now.
81
+ * so we'll use the Timer for now.
82
82
*/
83
- wait_ms (10 );
83
+ {
84
+ Timer timer;
85
+ timer.start ();
86
+ int start = timer.read_ms ();
87
+ int end = start + 10 ;
88
+ while (timer.read_ms () < end) {
89
+ }
90
+ }
84
91
85
92
ticker_set_handler (lp_ticker_data, cb_done_deepsleep);
86
93
ticker_remove_event (lp_ticker_data, &delay_event);
You can’t perform that action at this time.
0 commit comments