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 7ed16fb commit 276ef91Copy full SHA for 276ef91
platform/mbed_wait_api_no_rtos.c
@@ -37,9 +37,19 @@ void wait_ms(int ms)
37
38
void wait_us(int us)
39
{
40
+#if DEVICE_USTICKER
41
const ticker_data_t *const ticker = get_us_ticker_data();
42
uint32_t start = ticker_read(ticker);
43
while ((ticker_read(ticker) - start) < (uint32_t)us);
44
+#else // fallback to wait_ns for targets without usticker
45
+ while (us > 1000) {
46
+ us -= 1000;
47
+ wait_ns(1000000);
48
+ }
49
+ if (us > 0) {
50
+ wait_ns(us * 1000);
51
52
+#endif // DEVICE_USTICKER
53
}
54
55
#endif // #ifndef MBED_CONF_RTOS_PRESENT
0 commit comments