From 7dc0aa16ec06dd35813beec825168ac568d88d3d Mon Sep 17 00:00:00 2001 From: Khoi Hoang <57012152+khoih-prog@users.noreply.github.com> Date: Sun, 16 May 2021 23:48:44 -0400 Subject: [PATCH] Add defs for compatibility (#142) Add definitions for compatibility to many platforms and libraries - clockCyclesPerMicrosecond() - clockCyclesToMicroseconds(a) - microsecondsToClockCycles(a) --- cores/rp2040/Arduino.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cores/rp2040/Arduino.h b/cores/rp2040/Arduino.h index f8a32aa81..99c1eb85b 100644 --- a/cores/rp2040/Arduino.h +++ b/cores/rp2040/Arduino.h @@ -40,6 +40,11 @@ extern "C"{ #endif // __cplusplus +// For compatibility to many platforms and libraries +#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L ) +#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() ) +#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() ) + // Disable/reenable all interrupts. Safely handles nested disables void interrupts(); void noInterrupts();