Platform drivers for Mbed.

Dependents:   EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more

Revision:
9:9e247b9c9abf
Parent:
8:70fc373a5f46
Child:
10:b5115cd6b916
--- a/src/delay.cpp	Wed Feb 26 06:09:13 2020 +0000
+++ b/src/delay.cpp	Mon Jun 15 13:03:55 2020 +0000
@@ -33,8 +33,14 @@
  */
 void udelay(uint32_t usecs)
 {
-	if (usecs) {
-		// Unused variable - fix compiler warning
+	if (usecs < 1000) {
+		// Simple delay, minimum time is 1ms.
+		HAL_Delay(1);
+	} else {
+		// This is a simple approach to guarantee a delay
+		usecs /= 1000;
+		usecs++;             // Simple 'ceiling' to round up to guarantee minimum delay
+		HAL_Delay(usecs);
 	}
 }