My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

macros.h 765B

12345678910111213141516171819202122232425262728
  1. #ifndef MACROS_H
  2. #define MACROS_H
  3. // Macros for bit masks
  4. #define TEST(n,b) (((n)&_BV(b))!=0)
  5. #define SBI(n,b) (n |= _BV(b))
  6. #define CBI(n,b) (n &= ~_BV(b))
  7. #define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b))
  8. // Macros for maths shortcuts
  9. #define RADIANS(d) ((d)*M_PI/180.0)
  10. #define DEGREES(r) ((r)*180.0/M_PI)
  11. // Macros to contrain values
  12. #define NOLESS(v,n) do{ if (v < n) v = n; }while(0)
  13. #define NOMORE(v,n) do{ if (v > n) v = n; }while(0)
  14. // Macros to support option testing
  15. #define _CAT(a, ...) a ## __VA_ARGS__
  16. #define SWITCH_ENABLED_0 0
  17. #define SWITCH_ENABLED_1 1
  18. #define SWITCH_ENABLED_ 1
  19. #define ENABLED(b) _CAT(SWITCH_ENABLED_, b)
  20. #define DISABLED(b) (!_CAT(SWITCH_ENABLED_, b))
  21. #define COUNT(a) (sizeof(a)/sizeof(*a))
  22. #endif //__MACROS_H