We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 56a1760 commit 98134a4Copy full SHA for 98134a4
platform/mbed_wait_api_rtos.cpp
@@ -39,11 +39,10 @@ void wait_us(int us)
39
const ticker_data_t *const ticker = get_us_ticker_data();
40
41
uint32_t start = ticker_read(ticker);
42
- // Use the RTOS to wait for millisecond delays if possible
43
- int ms = us / 1000;
44
- if ((ms > 0) && core_util_are_interrupts_enabled()) {
+ if ((us >= 1000) && core_util_are_interrupts_enabled()) {
+ // Use the RTOS to wait for millisecond delays if possible
45
sleep_manager_lock_deep_sleep();
46
- Thread::wait((uint32_t)ms);
+ Thread::wait((uint32_t)us / 1000);
47
sleep_manager_unlock_deep_sleep();
48
}
49
// Use busy waiting for sub-millisecond delays, or for the whole
0 commit comments