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 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