@@ -61,17 +61,17 @@ void sleep_usticker_test()
6161
6262 const ticker_irq_handler_type us_ticker_irq_handler_org = set_us_ticker_irq_handler (us_ticker_isr);
6363
64- /* Give some time Green Tea to finish UART transmission before entering
65- * sleep mode.
66- */
67- busy_wait_ms (SERIAL_FLUSH_TIME_MS);
68-
6964 /* Test only sleep functionality. */
7065 sleep_manager_lock_deep_sleep ();
7166 TEST_ASSERT_FALSE_MESSAGE (sleep_manager_can_deep_sleep (), " deep sleep should be locked" );
7267
7368 /* Testing wake-up time 10 us. */
7469 for (timestamp_t i = 100 ; i < 1000 ; i += 100 ) {
70+ /* Give some time Green Tea to finish UART transmission before entering
71+ * sleep mode.
72+ */
73+ busy_wait_ms (SERIAL_FLUSH_TIME_MS);
74+
7575 /* note: us_ticker_read() operates on ticks. */
7676 const timestamp_t start_timestamp = us_ticker_read ();
7777 const timestamp_t next_match_timestamp = overflow_protect (start_timestamp + us_to_ticks (i, ticker_freq),
@@ -108,15 +108,15 @@ void deepsleep_lpticker_test()
108108
109109 const ticker_irq_handler_type lp_ticker_irq_handler_org = set_lp_ticker_irq_handler (lp_ticker_isr);
110110
111- /* Give some time Green Tea to finish UART transmission before entering
112- * deep-sleep mode.
113- */
114- busy_wait_ms (SERIAL_FLUSH_TIME_MS);
115-
116111 TEST_ASSERT_TRUE_MESSAGE (sleep_manager_can_deep_sleep (), " deep sleep should not be locked" );
117112
118113 /* Testing wake-up time 10 ms. */
119114 for (timestamp_t i = 20000 ; i < 200000 ; i += 20000 ) {
115+ /* Give some time Green Tea to finish UART transmission before entering
116+ * deep-sleep mode.
117+ */
118+ busy_wait_ms (SERIAL_FLUSH_TIME_MS);
119+
120120 /* note: lp_ticker_read() operates on ticks. */
121121 const timestamp_t start_timestamp = lp_ticker_read ();
122122 const timestamp_t next_match_timestamp = overflow_protect (start_timestamp + us_to_ticks (i, ticker_freq), ticker_width);
0 commit comments