Skip to content

Commit 6a9c795

Browse files
Merge branch 'stevstrong-patch-16'
2 parents b31efe8 + 92cdd1a commit 6a9c795

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

STM32F1/cores/maple/wirish_time.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,18 @@
3434
#include <libmaple/delay.h>
3535
#include "Arduino.h"
3636

37-
void delay(unsigned long ms) {
38-
uint32 start = millis();
39-
do
40-
{
41-
yield();
42-
}
43-
while (millis() - start < ms);
37+
void delay(unsigned long ms)
38+
{
39+
uint32 start = micros();
40+
while (ms > 0)
41+
{
42+
yield();
43+
while ( (ms > 0) && ((micros() - start) >= 1000) )
44+
{
45+
ms--;
46+
start += 1000;
47+
}
48+
}
4449
}
4550

4651
void delayMicroseconds(uint32 us) {

0 commit comments

Comments
 (0)