tmc2130.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef TMC2130_H
  2. #define TMC2130_H
  3. extern uint8_t tmc2130_cs[4];
  4. //mode
  5. extern uint8_t tmc2130_mode;
  6. //holding and running currents
  7. extern uint8_t tmc2130_current_h[4];
  8. extern uint8_t tmc2130_current_r[4];
  9. //flags for axis stall detection
  10. extern uint8_t tmc2130_axis_stalled[4];
  11. extern uint8_t tmc2131_axis_sg_thr[4];
  12. extern bool tmc2130_sg_stop_on_crash;
  13. extern bool tmc2130_sg_crash;
  14. #define TMC2130_MODE_NORMAL 0
  15. #define TMC2130_MODE_SILENT 1
  16. //initialize tmc2130
  17. extern void tmc2130_init();
  18. //check diag pins (called from stepper isr)
  19. extern void tmc2130_st_isr(uint8_t last_step_mask);
  20. //update stall guard (called from st_synchronize inside the loop)
  21. extern bool tmc2130_update_sg();
  22. //temperature watching (called from )
  23. extern void tmc2130_check_overtemp();
  24. //enter homing (called from homeaxis before homing starts)
  25. extern void tmc2130_home_enter(uint8_t axes_mask);
  26. //exit homing (called from homeaxis after homing ends)
  27. extern void tmc2130_home_exit();
  28. //restart homing (called from homeaxis befor move)
  29. extern void tmc2130_home_restart(uint8_t axis);
  30. //set holding current for any axis (M911)
  31. extern void tmc2130_set_current_h(uint8_t axis, uint8_t current);
  32. //set running current for any axis (M912)
  33. extern void tmc2130_set_current_r(uint8_t axis, uint8_t current);
  34. //print currents (M913)
  35. extern void tmc2130_print_currents();
  36. //set PWM_AMPL for any axis (M917)
  37. extern void tmc2130_set_pwm_ampl(uint8_t axis, uint8_t pwm_ampl);
  38. //set PWM_GRAD for any axis (M918)
  39. extern void tmc2130_set_pwm_grad(uint8_t axis, uint8_t pwm_ampl);
  40. extern uint16_t tmc2130_rd_MSCNT(uint8_t cs);
  41. #endif //TMC2130_H