My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

macros.h 940B

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