mbed

Fork of mbed-dev by mbed official

Revision:
177:447f873cad2f
Parent:
171:19eb464bc2be
Child:
181:96ed750bd169
diff -r af195413fb11 -r 447f873cad2f drivers/UARTSerial.cpp
--- a/drivers/UARTSerial.cpp	Wed Oct 11 12:45:49 2017 +0100
+++ b/drivers/UARTSerial.cpp	Wed Oct 25 14:53:38 2017 +0100
@@ -19,7 +19,12 @@
 #include <errno.h>
 #include "UARTSerial.h"
 #include "platform/mbed_poll.h"
+
+#if MBED_CONF_RTOS_PRESENT
+#include "rtos/Thread.h"
+#else
 #include "platform/mbed_wait_api.h"
+#endif
 
 namespace mbed {
 
@@ -277,6 +282,17 @@
     }
 }
 
+void UARTSerial::wait_ms(uint32_t millisec)
+{
+    /* wait_ms implementation for RTOS spins until exact microseconds - we
+     * want to just sleep until next tick.
+     */
+#if MBED_CONF_RTOS_PRESENT
+    rtos::Thread::wait(millisec);
+#else
+    ::wait_ms(millisec);
+#endif
+}
 } //namespace mbed
 
 #endif //(DEVICE_SERIAL && DEVICE_INTERRUPTIN)