Prototype of class for the TMC5130 Driver.
More...
#include <uStepperDriver.h>
Prototype of class for the TMC5130 Driver.
This class enables the user of the library to access the TMC5130
Driver on the uStepper S board.
Definition at line 149 of file uStepperDriver.h.
◆ uStepperDriver()
uStepperDriver::uStepperDriver |
( |
void |
| ) |
|
Constructor.
This is the constructor of the uStepperDriver class.
Definition at line 35 of file uStepperDriver.cpp.
◆ chipSelect()
void uStepperDriver::chipSelect |
( |
bool |
state | ) |
|
|
protected |
◆ clearStall()
void uStepperDriver::clearStall |
( |
void |
| ) |
|
|
protected |
◆ disableStallguard()
void uStepperDriver::disableStallguard |
( |
void |
| ) |
|
|
protected |
◆ enableStallguard()
void uStepperDriver::enableStallguard |
( |
int8_t |
threshold, |
|
|
bool |
stopOnStall |
|
) |
| |
|
protected |
◆ enableStealth()
void uStepperDriver::enableStealth |
( |
void |
| ) |
|
|
protected |
◆ getPosition()
int32_t uStepperDriver::getPosition |
( |
void |
| ) |
|
Returns the current position of the motor driver.
This function returns the position of the motor
drivers internal position counter.
unit is in microsteps (default 1/256th).
- Returns
- microsteps (default 1/256th).
Definition at line 237 of file uStepperDriver.cpp.
◆ getStallValue()
uint16_t uStepperDriver::getStallValue |
( |
void |
| ) |
|
Returns the load measurement used for Stall detection.
Definition at line 399 of file uStepperDriver.cpp.
◆ getVelocity()
int32_t uStepperDriver::getVelocity |
( |
void |
| ) |
|
Returns the current speed of the motor driver.
This function returns the current speed of the
internal ramp generator of the motor driver.
unit is in ((microsteps/s)/8MHz)/2^23.
See page 74 of datasheet for more information
- Returns
- see description for unit
Definition at line 232 of file uStepperDriver.cpp.
◆ init()
void uStepperDriver::init |
( |
uStepperS * |
_pointer | ) |
|
Initiation of the motor driver.
This function initiates all the registers of the motor driver.
- Parameters
-
[in] | _pointer | - reference to the uStepper S object |
Definition at line 68 of file uStepperDriver.cpp.
◆ readMotorStatus()
void uStepperDriver::readMotorStatus |
( |
void |
| ) |
|
|
protected |
◆ readRegister()
int32_t uStepperDriver::readRegister |
( |
uint8_t |
address | ) |
|
Reads a register from the motor driver.
This function is used to read the content of
a register in the TMC5130 motor driver. Please
refer to datasheet for details.
- Returns
- Return data of the read register
- Parameters
-
[in] | address | - Register to read |
Definition at line 306 of file uStepperDriver.cpp.
◆ reset()
void uStepperDriver::reset |
( |
void |
| ) |
|
|
protected |
◆ setAcceleration()
void uStepperDriver::setAcceleration |
( |
uint32_t |
acceleration | ) |
|
Set motor acceleration.
This function tells the motor driver to use a specific acceleration while ramping up the velocity.
input unit is in (microsteps/s^2)/116.42. See page 74 of datasheet for more information
- Parameters
-
[in] | acceleration | - see description for unit |
Definition at line 117 of file uStepperDriver.cpp.
◆ setCurrent()
void uStepperDriver::setCurrent |
( |
uint8_t |
current | ) |
|
Set motor driver current.
- Parameters
-
[in] | current | - sets the current to use during movements in percent (0-100) |
Definition at line 141 of file uStepperDriver.cpp.
◆ setDeceleration()
void uStepperDriver::setDeceleration |
( |
uint32_t |
deceleration | ) |
|
Set motor deceleration.
This function tells the motor driver to use a specific deceleration while ramping down the velocity.
input unit is in (microsteps/s^2)/116.42. See page 74 of datasheet for more information
- Parameters
-
[in] | deceleration | - see description for unit |
Definition at line 129 of file uStepperDriver.cpp.
◆ setDirection()
void uStepperDriver::setDirection |
( |
bool |
direction | ) |
|
|
protected |
◆ setHoldCurrent()
void uStepperDriver::setHoldCurrent |
( |
uint8_t |
current | ) |
|
Set motor driver hold current.
- Parameters
-
[in] | current | - sets the current to use during standstill in percent (0-100) |
Definition at line 147 of file uStepperDriver.cpp.
◆ setHome()
void uStepperDriver::setHome |
( |
int32_t |
initialSteps = 0 | ) |
|
Resets the internal position counter of the motor driver.
- Parameters
-
[in] | initialSteps | - Home step offset from zero |
Definition at line 248 of file uStepperDriver.cpp.
◆ setPosition()
void uStepperDriver::setPosition |
( |
int32_t |
position | ) |
|
Set the motor position.
This function tells the motor to go to an absolute position.
- Parameters
-
[in] | position | - position the motor should move to, in micro steps (1/256th default) |
Definition at line 158 of file uStepperDriver.cpp.
◆ setRampMode()
void uStepperDriver::setRampMode |
( |
uint8_t |
mode | ) |
|
|
protected |
Set motor driver to position mode or velocity mode.
- Parameters
-
[in] | mode | - can be either POSITIONING_MODE or VELOCITY_MODE_POS |
Definition at line 189 of file uStepperDriver.cpp.
◆ setShaftDirection()
void uStepperDriver::setShaftDirection |
( |
bool |
direction | ) |
|
Set motor driver direction.
This function is used to set the direction of the motor driver
to either normal or inverted. In normal mode, a positiv target
position corresponds to a CW movement, while a negative target
position corresponds to a CCW movement.
- Parameters
-
[in] | direction | - 0 = normal direction, 1 = inverted direction |
Definition at line 166 of file uStepperDriver.cpp.
◆ setVelocity()
void uStepperDriver::setVelocity |
( |
uint32_t |
velocity | ) |
|
Set motor velocity.
This function tells the motor driver to make the motor spin at a specific velocity.
input unit is in ((microsteps/s)/8MHz)/2^23. See page 74 of datasheet for more information
- Parameters
-
[in] | velocity | - see description for unit |
Definition at line 105 of file uStepperDriver.cpp.
◆ stop()
void uStepperDriver::stop |
( |
void |
| ) |
|
◆ updateCurrent()
void uStepperDriver::updateCurrent |
( |
void |
| ) |
|
|
protected |
Writes the current setting registers of the motor driver
Definition at line 153 of file uStepperDriver.cpp.
◆ writeRegister()
int32_t uStepperDriver::writeRegister |
( |
uint8_t |
address, |
|
|
uint32_t |
datagram |
|
) |
| |
Write a register of the motor driver.
This function is used to write a value into
a register in the TMC5130 motor driver. Please
refer to datasheet for details.
When using this function you are on your own and expect you know what you are doing !
- Returns
- Return data associated with last SPI command
- Parameters
-
[in] | address | - Register to write |
[in] | datagram | - data to write into the register |
Definition at line 274 of file uStepperDriver.cpp.
◆ uStepperS
◆ A1
uint16_t uStepperDriver::A1 = 600 |
|
protected |
◆ AMAX
uint16_t uStepperDriver::AMAX = 100 |
|
protected |
◆ current
uint8_t uStepperDriver::current = 16 |
|
protected |
◆ D1
uint16_t uStepperDriver::D1 = 600 |
|
protected |
◆ DMAX
uint16_t uStepperDriver::DMAX = 600 |
|
protected |
◆ holdCurrent
uint8_t uStepperDriver::holdCurrent = 0 |
|
protected |
◆ holdDelay
uint8_t uStepperDriver::holdDelay = 0 |
|
protected |
◆ mode
◆ pointer
◆ status
uint8_t uStepperDriver::status |
|
protected |
◆ V1
uint32_t uStepperDriver::V1 = 0 |
|
protected |
◆ VMAX
uint32_t uStepperDriver::VMAX = 200000 |
|
protected |
◆ VSTART
uint32_t uStepperDriver::VSTART = 0 |
|
protected |
Default acceleration profile for positioning mode
Definition at line 323 of file uStepperDriver.h.
◆ VSTOP
uint32_t uStepperDriver::VSTOP = 10 |
|
protected |
◆ xActual
volatile int32_t uStepperDriver::xActual = 0 |
◆ xTarget
volatile int32_t uStepperDriver::xTarget = 0 |
The documentation for this class was generated from the following files: