From 352e0df7d800b033ce24ad1022461f5d1908da93 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 14 Mar 2019 14:44:18 -0400 Subject: cleanup, display screen abstraction --- arduino/cores/nRF5/Arduino.h | 3 +++ arduino/cores/nRF5/common_func.h | 13 ++----------- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'arduino/cores') diff --git a/arduino/cores/nRF5/Arduino.h b/arduino/cores/nRF5/Arduino.h index fb06853..b77a872 100755 --- a/arduino/cores/nRF5/Arduino.h +++ b/arduino/cores/nRF5/Arduino.h @@ -86,6 +86,7 @@ uint32_t setLoopStacksize(void); #include "wiring_shift.h" #include "WInterrupts.h" +#ifndef __cplusplus // undefine stdlib's abs if encountered #ifdef abs #undef abs @@ -94,6 +95,8 @@ uint32_t setLoopStacksize(void); #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) #define abs(x) ((x)>0?(x):-(x)) +#endif // __cplusplus + #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) #define radians(deg) ((deg)*DEG_TO_RAD) diff --git a/arduino/cores/nRF5/common_func.h b/arduino/cores/nRF5/common_func.h index 6862dab..081426e 100755 --- a/arduino/cores/nRF5/common_func.h +++ b/arduino/cores/nRF5/common_func.h @@ -52,17 +52,8 @@ #define __swap32(x) __REV(x) ///< built-in function to swap Endian of 32-bit number #define __swap16(u16) ((uint16_t) __REV16(u16)) ///< built-in function to swap Endian of 16-bit number -#ifndef __cplusplus -#ifndef max -#define max(a, b) ((a) > (b) ? (a) : (b)) -#endif // max -#ifndef min -#define min(a, b) ((a) < (b) ? (a) : (b)) -#endif // min -#endif // __cplusplus - -#define maxof(a,b) max(a, b) -#define minof(a,b) min(a, b) +#define maxof(a, b) ((a) > (b) ? (a) : (b)) +#define minof(a, b) ((a) < (b) ? (a) : (b)) /*------------------------------------------------------------------*/ /* Count number of arguments of __VA_ARGS__ -- cgit v1.2.3