tmc2130.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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[2];
  11. extern uint8_t sg_thrs_x;
  12. extern uint8_t sg_thrs_y;
  13. #define TMC2130_MODE_NORMAL 0
  14. #define TMC2130_MODE_SILENT 1
  15. //initialize tmc2130
  16. extern void tmc2130_init();
  17. //update stall guard (called from st_synchronize inside the loop)
  18. extern bool tmc2130_update_sg();
  19. //temperature watching (called from )
  20. extern void tmc2130_check_overtemp();
  21. //enter homing (called from homeaxis before homing starts)
  22. extern void tmc2130_home_enter(uint8_t axes_mask);
  23. //exit homing (called from homeaxis after homing ends)
  24. extern void tmc2130_home_exit();
  25. //restart homing (called from homeaxis befor move)
  26. extern void tmc2130_home_restart(uint8_t axis);
  27. //set holding current for any axis (M911)
  28. extern void tmc2130_set_current_h(uint8_t axis, uint8_t current);
  29. //set running current for any axis (M912)
  30. extern void tmc2130_set_current_r(uint8_t axis, uint8_t current);
  31. //print currents (M913)
  32. extern void tmc2130_print_currents();
  33. //set PWM_AMPL for any axis (M917)
  34. extern void tmc2130_set_pwm_ampl(uint8_t axis, uint8_t pwm_ampl);
  35. //set PWM_GRAD for any axis (M918)
  36. extern void tmc2130_set_pwm_grad(uint8_t axis, uint8_t pwm_ampl);
  37. extern uint16_t tmc2130_rd_MSCNT(uint8_t cs);
  38. #endif //TMC2130_H