2017-06-29 16:35:43 +00:00
|
|
|
#ifndef TMC2130_H
|
|
|
|
#define TMC2130_H
|
|
|
|
|
2017-07-12 15:36:50 +00:00
|
|
|
extern uint8_t tmc2130_cs[4];
|
|
|
|
|
2017-07-03 05:43:50 +00:00
|
|
|
//mode
|
|
|
|
extern uint8_t tmc2130_mode;
|
2017-07-01 10:39:16 +00:00
|
|
|
//holding and running currents
|
|
|
|
extern uint8_t tmc2130_current_h[4];
|
|
|
|
extern uint8_t tmc2130_current_r[4];
|
|
|
|
//flags for axis stall detection
|
2017-09-22 17:28:32 +00:00
|
|
|
extern uint8_t tmc2130_axis_stalled[4];
|
|
|
|
|
2017-09-25 23:43:56 +00:00
|
|
|
extern uint8_t tmc2130_sg_thr[4];
|
2017-09-22 17:28:32 +00:00
|
|
|
|
2017-09-23 13:01:31 +00:00
|
|
|
extern bool tmc2130_sg_stop_on_crash;
|
2017-09-22 17:28:32 +00:00
|
|
|
extern bool tmc2130_sg_crash;
|
2017-07-01 10:39:16 +00:00
|
|
|
|
|
|
|
|
2017-07-03 05:43:50 +00:00
|
|
|
#define TMC2130_MODE_NORMAL 0
|
|
|
|
#define TMC2130_MODE_SILENT 1
|
2017-07-01 10:39:16 +00:00
|
|
|
|
|
|
|
//initialize tmc2130
|
|
|
|
extern void tmc2130_init();
|
2017-09-22 17:28:32 +00:00
|
|
|
//check diag pins (called from stepper isr)
|
|
|
|
extern void tmc2130_st_isr(uint8_t last_step_mask);
|
2017-07-01 10:39:16 +00:00
|
|
|
//update stall guard (called from st_synchronize inside the loop)
|
|
|
|
extern bool tmc2130_update_sg();
|
|
|
|
//temperature watching (called from )
|
|
|
|
extern void tmc2130_check_overtemp();
|
|
|
|
//enter homing (called from homeaxis before homing starts)
|
2017-07-12 15:36:50 +00:00
|
|
|
extern void tmc2130_home_enter(uint8_t axes_mask);
|
2017-07-01 10:39:16 +00:00
|
|
|
//exit homing (called from homeaxis after homing ends)
|
|
|
|
extern void tmc2130_home_exit();
|
2017-07-12 15:36:50 +00:00
|
|
|
//restart homing (called from homeaxis befor move)
|
|
|
|
extern void tmc2130_home_restart(uint8_t axis);
|
2017-07-01 10:39:16 +00:00
|
|
|
|
2017-07-03 08:39:56 +00:00
|
|
|
//set holding current for any axis (M911)
|
2017-07-01 10:39:16 +00:00
|
|
|
extern void tmc2130_set_current_h(uint8_t axis, uint8_t current);
|
2017-07-03 08:39:56 +00:00
|
|
|
//set running current for any axis (M912)
|
2017-07-01 10:39:16 +00:00
|
|
|
extern void tmc2130_set_current_r(uint8_t axis, uint8_t current);
|
2017-07-03 08:39:56 +00:00
|
|
|
//print currents (M913)
|
2017-07-01 10:39:16 +00:00
|
|
|
extern void tmc2130_print_currents();
|
|
|
|
|
2017-07-06 11:06:07 +00:00
|
|
|
//set PWM_AMPL for any axis (M917)
|
|
|
|
extern void tmc2130_set_pwm_ampl(uint8_t axis, uint8_t pwm_ampl);
|
|
|
|
//set PWM_GRAD for any axis (M918)
|
|
|
|
extern void tmc2130_set_pwm_grad(uint8_t axis, uint8_t pwm_ampl);
|
|
|
|
|
2017-07-03 08:39:56 +00:00
|
|
|
|
2017-07-12 15:36:50 +00:00
|
|
|
extern uint16_t tmc2130_rd_MSCNT(uint8_t cs);
|
|
|
|
|
2017-09-23 18:01:37 +00:00
|
|
|
extern void tmc2130_home_pause(uint8_t axis);
|
|
|
|
extern void tmc2130_home_resume(uint8_t axis);
|
2017-09-26 10:22:58 +00:00
|
|
|
extern bool tmc2130_wait_standstill_xy(int timeout);
|
2017-09-23 18:01:37 +00:00
|
|
|
|
2017-07-12 15:36:50 +00:00
|
|
|
|
2017-07-01 10:39:16 +00:00
|
|
|
#endif //TMC2130_H
|