Update platform drivers
Diff: src/delay.cpp
- Revision:
- 9:9e247b9c9abf
- Parent:
- 8:70fc373a5f46
- Child:
- 10:b5115cd6b916
diff -r 70fc373a5f46 -r 9e247b9c9abf src/delay.cpp --- 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); } }