From a4afb42b08555310142d01bbf346285e4fc9bff5 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Sun, 17 Oct 2010 17:55:53 -0400 Subject: 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 --- cores/arduino/wiring.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cores/arduino/wiring.h') 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)) -- cgit v1.2.3-18-g5258