PaulStoffregen 9 년 전
부모
커밋
2746714809
1개의 변경된 파일28개의 추가작업 그리고 7개의 파일을 삭제
  1. +28
    -7
      teensy3/wiring.h

+ 28
- 7
teensy3/wiring.h 파일 보기

@@ -57,15 +57,36 @@ extern "C"{
#undef abs
#endif

#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))
#define min(a, b) ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
(_a < _b) ? _a : _b; \
})
#define max(a, b) ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
(_a > _b) ? _a : _b; \
})
#define abs(x) ({ \
typeof(x) _x = (x); \
(_x > 0) ? _x : -_x; \
})
#define constrain(amt, low, high) ({ \
typeof(amt) _amt = (amt); \
typeof(low) _low = (low); \
typeof(high) _high = (high); \
(_amt < _low) ? _low : ((_amt > _high) ? _high : _amt); \
})
#define round(x) ({ \
typeof(x) _x = (x); \
(_x>=0) ? (long)(_x+0.5) : (long)(_x-0.5); \
})
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)
#define sq(x) ((x)*(x))

#define sq(x) ({ \
typeof(x) _x = (x); \
_x * _x; \
})
#define sei() __enable_irq()
#define cli() __disable_irq()
#define interrupts() __enable_irq()

Loading…
취소
저장