diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2009-12-18 17:04:51 +0000 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2009-12-18 17:04:51 +0000 |
commit | 78a3d76f6cd1a70652f31904009f06c5038270de (patch) | |
tree | f70190c28763a0cd9ee63d464028354c42e92bc5 /cores/arduino/wiring.c | |
parent | 35f5f6e99f15e0cc674c814937c82ef5fbbf86c3 (diff) |
No longer disabling interrupts in delayMicroseconds(): http://code.google.com/p/arduino/issues/detail?id=67
Diffstat (limited to 'cores/arduino/wiring.c')
-rwxr-xr-x | cores/arduino/wiring.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c index 72bc282..7d3e611 100755 --- a/cores/arduino/wiring.c +++ b/cores/arduino/wiring.c @@ -103,13 +103,9 @@ void delay(unsigned long ms) ; } -/* 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. */ +/* Delay for the given number of microseconds. Assumes a 8 or 16 MHz clock. */ void delayMicroseconds(unsigned int us) { - uint8_t oldSREG; - // calling avrlib's delay_us() function with low values (e.g. 1 or // 2 microseconds) gives delays longer than desired. //delay_us(us); @@ -150,19 +146,11 @@ void delayMicroseconds(unsigned int us) us--; #endif - // disable interrupts, otherwise the timer 0 overflow interrupt that - // tracks milliseconds will make us delay longer than we want. - oldSREG = SREG; - cli(); - // busy wait __asm__ __volatile__ ( "1: sbiw %0,1" "\n\t" // 2 cycles "brne 1b" : "=w" (us) : "0" (us) // 2 cycles ); - - // reenable interrupts. - SREG = oldSREG; } void init() |