2525#ifndef MBED_WAIT_API_H
2626#define MBED_WAIT_API_H
2727
28+ #include "platform/mbed_toolchain.h"
2829#include "platform/mbed_atomic.h"
2930#include "device.h"
3031
@@ -62,7 +63,16 @@ extern "C" {
6263 * If the RTOS is present, this function spins to get the exact number of microseconds for
6364 * microsecond precision up to 10 milliseconds. If delay is larger than 10 milliseconds and not in ISR, it is the same as
6465 * `wait_ms`. We recommend `wait_us` and `wait_ms` over `wait`.
66+ *
67+ * @deprecated
68+ * 'wait' is deprecated in favor of explicit sleep functions. To sleep, 'wait' should be replaced by
69+ * 'ThisThread::sleep_for' (C++) or 'thread_sleep_for' (C). If you wish to wait (without sleeping), call
70+ * 'wait_us'. 'wait_us' is safe to call from ISR context.
6571 */
72+ MBED_DEPRECATED_SINCE ("mbed-os-5.14" ,
73+ "'wait' is deprecated in favor of explicit sleep functions. To sleep, 'wait' should be replaced by "
74+ "'ThisThread::sleep_for' (C++) or 'thread_sleep_for' (C). If you wish to wait (without sleeping), call "
75+ "'wait_us'. 'wait_us' is safe to call from ISR context." )
6676void wait (float s );
6777
6878/** Waits a number of milliseconds.
@@ -72,7 +82,16 @@ void wait(float s);
7282 * @note
7383 * If the RTOS is present, it calls ThisThread::sleep_for(), which is same as CMSIS osDelay().
7484 * You can't call this from interrupts, and it doesn't lock hardware sleep.
85+ *
86+ * @deprecated
87+ * 'wait_ms' is deprecated in favor of explicit sleep functions. To sleep, 'wait_ms' should be replaced by
88+ * 'ThisThread::sleep_for' (C++) or 'thread_sleep_for' (C). If you wish to wait (without sleeping), call
89+ * 'wait_us'. 'wait_us' is safe to call from ISR context.
7590 */
91+ MBED_DEPRECATED_SINCE ("mbed-os-5.14" ,
92+ "'wait_ms' is deprecated in favor of explicit sleep functions. To sleep, 'wait_ms' should be replaced by "
93+ "'ThisThread::sleep_for' (C++) or 'thread_sleep_for' (C). If you wish to wait (without sleeping), call "
94+ "'wait_us'. 'wait_us' is safe to call from ISR context." )
7695void wait_ms (int ms );
7796
7897/** Waits a number of microseconds.
@@ -82,7 +101,7 @@ void wait_ms(int ms);
82101 * @note
83102 * This function always spins to get the exact number of microseconds.
84103 * This will affect power and multithread performance. Therefore, spinning for
85- * millisecond wait is not recommended, and wait_ms() should
104+ * millisecond wait is not recommended, and ThisThread::sleep_for should
86105 * be used instead.
87106 *
88107 * @note You may call this function from ISR context, but large delays may
0 commit comments