aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/wiring.h
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2010-10-17 17:55:53 -0400
committerDavid A. Mellis <d.mellis@arduino.cc>2010-10-17 17:55:53 -0400
commita4afb42b08555310142d01bbf346285e4fc9bff5 (patch)
tree9fe489e064ce72475a0f1dcc348f5cd66a7f54ed /cores/arduino/wiring.h
parentb861fe903f5a91990667e0eb47d2f83586bd0408 (diff)
Modifying basic functions (digital and analog, read and write) to use register-based ifdefs, not cpu-based.
http://code.google.com/p/arduino/issues/detail?id=307 http://code.google.com/p/arduino/issues/detail?id=316 http://code.google.com/p/arduino/issues/detail?id=323 http://code.google.com/p/arduino/issues/detail?id=324
Diffstat (limited to 'cores/arduino/wiring.h')
-rwxr-xr-xcores/arduino/wiring.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/cores/arduino/wiring.h b/cores/arduino/wiring.h
index 7245797..027a8d1 100755
--- a/cores/arduino/wiring.h
+++ b/cores/arduino/wiring.h
@@ -85,8 +85,8 @@ extern "C"{
#define noInterrupts() cli()
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
-#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
-#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
+#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (F_CPU / 1000L) )
+#define microsecondsToClockCycles(a) ( ((a) * (F_CPU / 1000L)) / 1000L )
#define lowByte(w) ((uint8_t) ((w) & 0xff))
#define highByte(w) ((uint8_t) ((w) >> 8))