aboutsummaryrefslogtreecommitdiff
path: root/cores
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2008-12-23 00:17:14 +0000
committerDavid A. Mellis <d.mellis@arduino.cc>2008-12-23 00:17:14 +0000
commit7a5a60304213959b3fb9677df8296b8faf9195a4 (patch)
treea489274b600a5e698590bf0acd01506b5da7e2ec /cores
parentae9bcfb090b416adc183e17e92f3f4c91c5988df (diff)
Fixing delay() to delay at least N milliseconds.
Fixing register name in micros() for ATmega8.
Diffstat (limited to 'cores')
-rwxr-xr-xcores/arduino/wiring.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c
index 2896647..aaf7b86 100755
--- a/cores/arduino/wiring.c
+++ b/cores/arduino/wiring.c
@@ -59,8 +59,14 @@ unsigned long micros() {
cli();
t = TCNT0;
+
+#ifdef TIFR0
if ((TIFR0 & _BV(TOV0)) && (t == 0))
t = 256;
+#else
+ if ((TIFR & _BV(TOV0)) && (t == 0))
+ t = 256;
+#endif
m = timer0_overflow_count;
SREG = oldSREG;
@@ -72,7 +78,7 @@ void delay(unsigned long ms)
{
unsigned long start = millis();
- while (millis() - start < ms)
+ while (millis() - start <= ms)
;
}