uStepper S-lite
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Tmc2208 Class Reference

Prototype of class for accessing all features of the TMC2208 in a single object. More...

#include <TMC2208.h>

Public Member Functions

 Tmc2208 (void)
 Constructor. More...
 
void setup (void)
 Initializes the different parts of the TMC2208 object. More...
 
void disableDriver (void)
 Disable the stepper motor driver - TMC2208. More...
 
void enableDriver (void)
 Enable the stepper motor driver - TMC2208. More...
 
void setCurrent (uint8_t runPercent, uint8_t holdPercent)
 Change run and hold current settings of the stepper motor driver - TMC2208. More...
 
void setHoldCurrent (uint8_t holdPercent)
 Change hold current setting of the stepper motor driver - TMC2208. More...
 
void setRunCurrent (uint8_t runPercent)
 Change run current setting of the stepper motor driver - TMC2208. More...
 
void setVelocity (float RPM)
 Set motor velocity in RPM. More...
 
void invertDirection (bool normal=INVERSEDIRECTION)
 Invert motor direction. More...
 
float getRunCurrent (void)
 
float getHoldCurrent (void)
 

Protected Member Functions

void writeRegister (uint8_t address, int32_t value)
 
void readRegister (uint8_t address, int32_t *value)
 
uint8_t calcCRC (uint8_t datagram[], uint8_t len)
 
void uartInit (void)
 
void uartSendByte (uint8_t value)
 
bool uartReceivePacket (uint8_t *packet __attribute__((unused)), uint8_t size __attribute__((unused)))
 

Protected Attributes

uint8_t runCurrent
 
uint8_t holdCurrent
 

Detailed Description

Prototype of class for accessing all features of the TMC2208 in a single object.

This class enables the user of the library to access the implemented features of the TMC2208 driver, by use of a single object.

Definition at line 277 of file TMC2208.h.

Constructor & Destructor Documentation

◆ Tmc2208()

Tmc2208::Tmc2208 ( void  )

Constructor.

        This is the constructor of the TMC2208 class.

Definition at line 109 of file TMC2208.cpp.

Member Function Documentation

◆ disableDriver()

void Tmc2208::disableDriver ( void  )

Disable the stepper motor driver - TMC2208.

        This function lets the user disable the stepper driver.

Definition at line 155 of file TMC2208.cpp.

◆ enableDriver()

void Tmc2208::enableDriver ( void  )

Enable the stepper motor driver - TMC2208.

        This function lets the user enable the stepper driver.

Definition at line 150 of file TMC2208.cpp.

◆ invertDirection()

void Tmc2208::invertDirection ( bool  normal = INVERSEDIRECTION)

Invert motor direction.

        This function lets the user invert the motor direction - i.e. changing CW to CCW and vise versa.
Parameters
normal- Can be set to either INVERSEDIRECTION or NORMALDIRECTION.

Definition at line 133 of file TMC2208.cpp.

◆ setCurrent()

void Tmc2208::setCurrent ( uint8_t  runPercent,
uint8_t  holdPercent 
)

Change run and hold current settings of the stepper motor driver - TMC2208.

        This function lets the user manipulate both run and hold current settings.
      Arguments accept natural number from zero (0) to hundred (100).
      Calls setCurrent and setHoldCurrent.
Parameters
runPercent- Run current in percentage of max current i.e. from 0 to 100.
holdPercent- Hold current in percentage of max current i.e. from 0 to 100.

Definition at line 196 of file TMC2208.cpp.

◆ setHoldCurrent()

void Tmc2208::setHoldCurrent ( uint8_t  holdPercent)

Change hold current setting of the stepper motor driver - TMC2208.

        This function lets the user manipulate hold current.
      Arguments accept natural number from zero (0) to hundred (100).
Parameters
holdPercent- Hold current in percentage of max current i.e. from 0 to 100.

Definition at line 215 of file TMC2208.cpp.

◆ setRunCurrent()

void Tmc2208::setRunCurrent ( uint8_t  runPercent)

Change run current setting of the stepper motor driver - TMC2208.

        This function lets the user manipulate run current.
      Arguments accept natural number from zero (0) to hundred (100).
Parameters
runPercent- Run current in percentage of max current i.e. from 0 to 100.

Definition at line 202 of file TMC2208.cpp.

◆ setup()

void Tmc2208::setup ( void  )

Initializes the different parts of the TMC2208 object.

        This function initializes the different parts of the TMC2208
        object, and is called in the setup() function of the
        uStepper S-lite object. This function is needed to setup basic registers of the TMC2208.

Definition at line 114 of file TMC2208.cpp.

◆ setVelocity()

void Tmc2208::setVelocity ( float  RPM)

Set motor velocity in RPM.

        This function lets the user command a run speed in RPM for open loop speed control.
Parameters
RPM- Desired speed of the motor in RPM.

Definition at line 228 of file TMC2208.cpp.

Member Data Documentation

◆ holdCurrent

uint8_t Tmc2208::holdCurrent
protected

This variable holds the commanded hold current

Definition at line 376 of file TMC2208.h.

◆ runCurrent

uint8_t Tmc2208::runCurrent
protected

This variable holds the commanded run current

Definition at line 372 of file TMC2208.h.


The documentation for this class was generated from the following files: