41#define DIRECTION(n) (((n)&0x1)<<4)
42#define EN_PWM_MODE(n) (((n)&0x1)<<2)
43#define I_SCALE_ANALOG(n) (((n)&0x1)<<0)
47#define IHOLD_IRUN 0x10
48#define TPOWERDOWN 0x11
58#define VSTART_REG 0x23
70#define SG_STOP(n) (((n)&0x1)<<10)
77#define FREEWHEEL(n) (((n)&0x3UL)<<20)
78#define PWM_AUTOSCALE(n) (((n)&0x1UL)<<18)
79#define PWM_FREQ(n) (((n)&0x3UL)<<16)
80#define PWM_GRAD(n) (((n)&0xFF)<<8)
81#define PWM_AMPL(n) (((n)&0xFF)<<0)
88#define DISS2G(n) (((n)&0x1UL)<<30)
89#define DEDGE(n) (((n)&0x1UL)<<29)
90#define INTPOL(n) (((n)&0x1UL)<<28)
91#define MRES(n) (((n)&0xFUL)<<24)
92#define SYNC(n) (((n)&0xFUL)<<20)
93#define VHIGHCHM(n) (((n)&0x1UL)<<19)
94#define VHIGHFS(n) (((n)&0x1UL)<<18)
95#define VSENSE(n) (((n)&0x1UL)<<17)
96#define TBL(n) (((n)&0x3UL)<<15)
97#define CHM(n) (((n)&0x1UL)<<14)
98#define RNDTF(n) (((n)&0x1)<<13)
99#define DISFDCC(n) (((n)&0x1)<<12)
100#define TFD3(n) (((n)&0x1)<<11)
101#define HEND(n) (((n)&0xF)<<7)
102#define HSTRT_TFD(n) (((n)&0x7)<<4)
103#define TOFF(n) (((n)&0xF)<<0)
109#define SFILT(n) (((n)&0x1UL)<<24)
110#define SGT(n) (((n)&0x7FUL)<<16)
111#define SEIMIN(n) (((n)&0x1UL)<<15)
112#define SEDN(n) (((n)&0x3)<<13)
113#define SEMAX(n) (((n)&0xF)<<8)
114#define SEUP(n) (((n)&0x3)<<5)
115#define SEMIN(n) (((n)&0xF)<<0)
119#define DC_SG(n) (((n)&0xFFUL)<<16)
120#define DC_TIME(n) (((n)&0x3FF)<<0)
122#define DRV_STATUS 0x6F
124#define IHOLDDELAY(n) (((n)&0xFUL)<<16)
125#define IRUN(n) (((n)&0x1F)<<8)
126#define IHOLD(n) (((n)&0x1F)<<0)
129#define WRITE_ACCESS 0x80
133#define POSITIONING_MODE 0x00
134#define VELOCITY_MODE_POS 0x01
135#define VELOCITY_MODE_NEG 0x02
136#define HOLD_MODE 0x03
139#define DRIVER_VELOCITY 1
140#define DRIVER_POSITION 2
142#define ACCELERATIONCONVERSION 1.0/116.415321827
143#define VELOCITYCONVERSION 1.0/0.953674316
267 void setHome(int32_t initialSteps = 0);
Prototype of class for the TMC5130 Driver.
void setAcceleration(uint32_t acceleration)
Set motor acceleration.
void setDirection(bool direction)
uint16_t getStallValue(void)
Returns the load measurement used for Stall detection.
void chipSelect(bool state)
void readMotorStatus(void)
void setDeceleration(uint32_t deceleration)
Set motor deceleration.
int32_t getPosition(void)
Returns the current position of the motor driver.
void disableStallguard(void)
void updateCurrent(void)
Writes the current setting registers of the motor driver
void setShaftDirection(bool direction)
Set motor driver direction.
uStepperDriver(void)
Constructor.
void stop(void)
Stops any ongoing movement with deceleration.
int32_t writeRegister(uint8_t address, uint32_t datagram)
Write a register of the motor driver.
void init(uStepperS *_pointer)
Initiation of the motor driver.
void setHoldCurrent(uint8_t current)
Set motor driver hold current.
void enableStallguard(int8_t threshold, bool stopOnStall, float rpm)
int32_t readRegister(uint8_t address)
Reads a register from the motor driver.
void setVelocity(uint32_t velocity)
Set motor velocity.
int32_t getVelocity(void)
Returns the current speed of the motor driver.
void setCurrent(uint8_t current)
Set motor driver current.
void setHome(int32_t initialSteps=0)
Resets the internal position counter of the motor driver.
void setRampMode(uint8_t mode)
Set motor driver to position mode or velocity mode.
void setPosition(int32_t position)
Set the motor position.
Prototype of class for accessing all features of the uStepper S in a single object.
Function prototypes and definitions for the uStepper S library.