aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/wiring.c
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2008-07-02 19:06:27 +0000
committerDavid A. Mellis <d.mellis@arduino.cc>2008-07-02 19:06:27 +0000
commit6bc00d87b802421686ffc6dad4259095a6655745 (patch)
treefb25378e5b27ceabee03c1b4a235043b5e243a58 /cores/arduino/wiring.c
parent79904311bb35ca52b51650f834683606e31882c2 (diff)
Adding ADXL3xx accelerometer example; minor comment changes.
Diffstat (limited to 'cores/arduino/wiring.c')
-rwxr-xr-xcores/arduino/wiring.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c
index 8459229..31e0247 100755
--- a/cores/arduino/wiring.c
+++ b/cores/arduino/wiring.c
@@ -42,6 +42,8 @@ unsigned long millis()
unsigned long m;
uint8_t oldSREG = SREG;
+ // disable interrupts while we read timer0_millis or we might get an
+ // inconsistent value (e.g. in the middle of the timer0_millis++)
cli();
m = timer0_millis;
SREG = oldSREG;
@@ -57,7 +59,7 @@ void delay(unsigned long ms)
;
}
-/* Delay for the given number of microseconds. Assumes a 16 MHz clock.
+/* Delay for the given number of microseconds. Assumes a 8 or 16 MHz clock.
* Disables interrupts, which will disrupt the millis() function if used
* too frequently. */
void delayMicroseconds(unsigned int us)