19 #ifndef _WIRING_CONSTANTS_
20 #define _WIRING_CONSTANTS_
58 #define PI 3.1415926535897932384626433832795f
60 #define HALF_PI 1.5707963267948966192313216916398f
61 #define TWO_PI 6.283185307179586476925286766559f
62 #define DEG_TO_RAD 0.017453292519943295769236907684886f
63 #define RAD_TO_DEG 57.295779513082320876798154814105f
64 #define EULER 2.718281828459045235360287471352f
90 #define min(a,b) ((a)<(b)?(a):(b))
94 #define max(a,b) ((a)>(b)?(a):(b))
97 #define abs(x) ((x)>0?(x):-(x))
98 #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
99 #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
100 #define radians(deg) ((deg)*DEG_TO_RAD)
101 #define degrees(rad) ((rad)*RAD_TO_DEG)
102 #define sq(x) ((x)*(x))
107 #define lowByte(w) ((uint8_t) ((w) & 0xff))
108 #define highByte(w) ((uint8_t) ((w) >> 8))
110 #define bitRead(value, bit) (((value) >> (bit)) & 0x01)
111 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
112 #define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
113 #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
115 typedef unsigned int word;
117 #define bit(b) (1UL << (b))
120 typedef uint8_t boolean;
121 typedef uint8_t byte;
126 #endif // __cplusplus