25
25
#ifndef MBED_WAIT_API_H
26
26
#define MBED_WAIT_API_H
27
27
28
+ #include "mbed_toolchain.h"
29
+
28
30
#ifdef __cplusplus
29
31
extern "C" {
30
32
#endif
@@ -59,7 +61,16 @@ extern "C" {
59
61
* If the RTOS is present, this function spins to get the exact number of microseconds for
60
62
* microsecond precision up to 10 milliseconds. If delay is larger than 10 milliseconds and not in ISR, it is the same as
61
63
* `wait_ms`. We recommend `wait_us` and `wait_ms` over `wait`.
64
+ *
65
+ * @deprecated
66
+ * 'wait' is deprecated in favor of explicit sleep functions. To sleep, 'wait' should be replaced by
67
+ * 'ThisThread::sleep_for' (C++) or 'thread_sleep_for' (C). If you wish to wait (without sleeping), call
68
+ * 'wait_us'. 'wait_us' is safe to call from ISR context.
62
69
*/
70
+ MBED_DEPRECATED_SINCE ("mbed-os-5.13" ,
71
+ "'wait' is deprecated in favor of explicit sleep functions. To sleep, 'wait' should be replaced by "
72
+ "'ThisThread::sleep_for' (C++) or 'thread_sleep_for' (C). If you wish to wait (without sleeping), call "
73
+ "'wait_us'. 'wait_us' is safe to call from ISR context." )
63
74
void wait (float s );
64
75
65
76
/** Waits a number of milliseconds.
@@ -69,7 +80,16 @@ void wait(float s);
69
80
* @note
70
81
* If the RTOS is present, it calls ThisThread::sleep_for(), which is same as CMSIS osDelay().
71
82
* You can't call this from interrupts, and it doesn't lock hardware sleep.
83
+ *
84
+ * @deprecated
85
+ * 'wait_ms' is deprecated in favor of explicit sleep functions. To sleep, 'wait_ms' should be replaced by
86
+ * 'ThisThread::sleep_for' (C++) or 'thread_sleep_for' (C). If you wish to wait (without sleeping), call
87
+ * 'wait_us'. 'wait_us' is safe to call from ISR context.
72
88
*/
89
+ MBED_DEPRECATED_SINCE ("mbed-os-5.13" ,
90
+ "'wait_ms' is deprecated in favor of explicit sleep functions. To sleep, 'wait_ms' should be replaced by "
91
+ "'ThisThread::sleep_for' (C++) or 'thread_sleep_for' (C). If you wish to wait (without sleeping), call "
92
+ "'wait_us'. 'wait_us' is safe to call from ISR context." )
73
93
void wait_ms (int ms );
74
94
75
95
/** Waits a number of microseconds.
@@ -79,7 +99,7 @@ void wait_ms(int ms);
79
99
* @note
80
100
* This function always spins to get the exact number of microseconds.
81
101
* This will affect power and multithread performance. Therefore, spinning for
82
- * millisecond wait is not recommended, and wait_ms() should
102
+ * millisecond wait is not recommended, and ThisThread::sleep_for should
83
103
* be used instead.
84
104
*
85
105
* @note You may call this function from ISR context, but large delays may
0 commit comments