mirror of https://github.com/ARMmbed/mbed-os.git
Avoid wait_ms() spin
System's wait_ms() spins to achieve a precise delay - we don't want this. Call Thread::wait directly.pull/5216/head
parent
3759d03fa1
commit
b18332cb4d
|
@ -19,7 +19,12 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "UARTSerial.h"
|
#include "UARTSerial.h"
|
||||||
#include "platform/mbed_poll.h"
|
#include "platform/mbed_poll.h"
|
||||||
|
|
||||||
|
#if MBED_CONF_RTOS_PRESENT
|
||||||
|
#include "rtos/Thread.h"
|
||||||
|
#else
|
||||||
#include "platform/mbed_wait_api.h"
|
#include "platform/mbed_wait_api.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
|
@ -277,6 +282,17 @@ void UARTSerial::tx_irq(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
} //namespace mbed
|
||||||
|
|
||||||
#endif //(DEVICE_SERIAL && DEVICE_INTERRUPTIN)
|
#endif //(DEVICE_SERIAL && DEVICE_INTERRUPTIN)
|
||||||
|
|
|
@ -160,6 +160,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void wait_ms(uint32_t millisec);
|
||||||
|
|
||||||
/** SerialBase lock override */
|
/** SerialBase lock override */
|
||||||
virtual void lock(void);
|
virtual void lock(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue