diff options
author | vbextreme <odsm@hotmail.it> | 2015-12-27 14:49:25 +0100 |
---|---|---|
committer | vbextreme <odsm@hotmail.it> | 2015-12-27 14:50:56 +0100 |
commit | ccb832c2246a05aac03c19727836102fdea17e1f (patch) | |
tree | 37be0066fdc357919835c3f45e28b52bb7393d4c /cores/arduino/wiring.c | |
parent | c96d9bc6ec215a60a781d9a07b31c86af0ae56eb (diff) |
fix delay/yield on avr, if function called by yield takes more a millisecond the delay fails
Diffstat (limited to 'cores/arduino/wiring.c')
-rw-r--r-- | cores/arduino/wiring.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c index 1c3e5a5..b956f78 100644 --- a/cores/arduino/wiring.c +++ b/cores/arduino/wiring.c @@ -105,11 +105,11 @@ unsigned long micros() { void delay(unsigned long ms) { - uint16_t start = (uint16_t)micros(); + uint32_t start = micros(); while (ms > 0) { yield(); - if (((uint16_t)micros() - start) >= 1000) { + while ( ms > 0 && (micros() - start) >= 1000) { ms--; start += 1000; } |