From 6bc00d87b802421686ffc6dad4259095a6655745 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Wed, 2 Jul 2008 19:06:27 +0000 Subject: Adding ADXL3xx accelerometer example; minor comment changes. --- cores/arduino/wiring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cores/arduino/wiring.c') 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) -- cgit v1.2.3-18-g5258