From dab7ee546edd96121eca64de8a6fc1ae7e504fc2 Mon Sep 17 00:00:00 2001 From: Patrick Fink Date: Sat, 16 Jan 2021 18:39:33 +0100 Subject: [PATCH] In case of C++ use std algorithms Co-Authored-By: Christoph Schulz --- cores/piduino/Arduino.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cores/piduino/Arduino.h b/cores/piduino/Arduino.h index 9ab4451c..d439c266 100644 --- a/cores/piduino/Arduino.h +++ b/cores/piduino/Arduino.h @@ -28,6 +28,14 @@ #include "pgmspace.h" #ifdef __cplusplus + +// https://github.com/esp8266/Arduino/blob/da138456a6394670540d19aa448c5291c35b2c02/cores/esp8266/Arduino.h#L224 +// https://github.com/esp8266/Arduino/blob/da138456a6394670540d19aa448c5291c35b2c02/cores/esp8266/Arduino.h#L232-L233 +#include +using std::min; +using std::max; +using std::abs; + extern "C"{ #endif @@ -72,9 +80,11 @@ void yield(void); #undef abs #endif +#ifndef __cplusplus #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) #define abs(x) ((x)>0?(x):-(x)) +#endif #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)