Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cores/arduino/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void loop( void ) ;
#include "WMath.h"
#include "HardwareSerial.h"
#include "pulse.h"
#include <bits/stl_algobase.h>
#endif
#include "delay.h"
#ifdef __cplusplus
Expand All @@ -92,6 +93,7 @@ void loop( void ) ;
#include "wiring_shift.h"
#include "WInterrupts.h"

#ifndef __cplusplus
// undefine stdlib's abs if encountered
#ifdef abs
#undef abs
Expand All @@ -100,8 +102,14 @@ void loop( void ) ;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(x) ((x)>0?(x):-(x))
#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))
#else
using std::min;
using std::max;

#endif

#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)
#define sq(x) ((x)*(x))
Expand Down