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.

67 lines
2.2 KiB

12 months ago
  1. /*
  2. * TMC5130_Constants.h
  3. *
  4. * Created on: 13.06.2018
  5. * Author: LK
  6. */
  7. #ifndef TMC_IC_TMC5130_TMC5130_CONSTANTS_H_
  8. #define TMC_IC_TMC5130_TMC5130_CONSTANTS_H_
  9. #define TMC5130_REGISTER_COUNT 128
  10. #define TMC5130_MOTORS 1
  11. #define TMC5130_WRITE_BIT 0x80
  12. #define TMC5130_ADDRESS_MASK 0x7F
  13. #define TMC5130_MAX_VELOCITY 8388096
  14. #define TMC5130_MAX_ACCELERATION 65535
  15. // ramp modes (Register TMC5161_RAMPMODE)
  16. #define TMC5130_MODE_POSITION 0
  17. #define TMC5130_MODE_VELPOS 1
  18. #define TMC5130_MODE_VELNEG 2
  19. #define TMC5130_MODE_HOLD 3
  20. // limit switch mode bits (Register TMC5130_SWMODE)
  21. #define TMC5130_SW_STOPL_ENABLE 0x0001
  22. #define TMC5130_SW_STOPR_ENABLE 0x0002
  23. #define TMC5130_SW_STOPL_POLARITY 0x0004
  24. #define TMC5130_SW_STOPR_POLARITY 0x0008
  25. #define TMC5130_SW_SWAP_LR 0x0010
  26. #define TMC5130_SW_LATCH_L_ACT 0x0020
  27. #define TMC5130_SW_LATCH_L_INACT 0x0040
  28. #define TMC5130_SW_LATCH_R_ACT 0x0080
  29. #define TMC5130_SW_LATCH_R_INACT 0x0100
  30. #define TMC5130_SW_LATCH_ENC 0x0200
  31. #define TMC5130_SW_SG_STOP 0x0400
  32. #define TMC5130_SW_SOFTSTOP 0x0800
  33. // Status bits (Register TMC5130_RAMPSTAT)
  34. #define TMC5130_RS_STOPL 0x0001
  35. #define TMC5130_RS_STOPR 0x0002
  36. #define TMC5130_RS_LATCHL 0x0004
  37. #define TMC5130_RS_LATCHR 0x0008
  38. #define TMC5130_RS_EV_STOPL 0x0010
  39. #define TMC5130_RS_EV_STOPR 0x0020
  40. #define TMC5130_RS_EV_STOP_SG 0x0040
  41. #define TMC5130_RS_EV_POSREACHED 0x0080
  42. #define TMC5130_RS_VELREACHED 0x0100
  43. #define TMC5130_RS_POSREACHED 0x0200
  44. #define TMC5130_RS_VZERO 0x0400
  45. #define TMC5130_RS_ZEROWAIT 0x0800
  46. #define TMC5130_RS_SECONDMOVE 0x1000
  47. #define TMC5130_RS_SG 0x2000
  48. // Encoderbits (Register TMC5130_ENCMODE)
  49. #define TMC5130_EM_DECIMAL 0x0400
  50. #define TMC5130_EM_LATCH_XACT 0x0200
  51. #define TMC5130_EM_CLR_XENC 0x0100
  52. #define TMC5130_EM_NEG_EDGE 0x0080
  53. #define TMC5130_EM_POS_EDGE 0x0040
  54. #define TMC5130_EM_CLR_ONCE 0x0020
  55. #define TMC5130_EM_CLR_CONT 0x0010
  56. #define TMC5130_EM_IGNORE_AB 0x0008
  57. #define TMC5130_EM_POL_N 0x0004
  58. #define TMC5130_EM_POL_B 0x0002
  59. #define TMC5130_EM_POL_A 0x0001
  60. #endif /* TMC_IC_TMC5130_TMC5130_CONSTANTS_H_ */