no-OS
Loading...
Searching...
No Matches
tmc5240.h File Reference

Header file for TMC5240 driver. More...

#include "no_os_spi.h"
#include "no_os_util.h"
Include dependency graph for tmc5240.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tmc5240_dev
 TMC5240 device descriptor. More...
 
struct  tmc5240_init_param
 TMC5240 initialization parameters. More...
 

Macros

#define TMC5240_DEFAULT_D1   10
 
#define TMC5240_DEFAULT_D2   10
 
#define TMC5240_DEFAULT_VSTOP   10
 

Functions

int tmc5240_init (struct tmc5240_dev **device, struct tmc5240_init_param *init_param)
 Initialize the TMC5240 device.
 
int tmc5240_remove (struct tmc5240_dev *device)
 Free the resources allocated by the tmc5240_init()
 
int tmc5240_reg_read (struct tmc5240_dev *device, uint8_t reg_addr, uint32_t *reg_data)
 Reads data from a given TMC5240 Register.
 
int tmc5240_reg_write (struct tmc5240_dev *device, uint8_t reg_addr, uint32_t reg_data)
 Writes data to a given TMC5240 Register.
 
int tmc5240_reg_update (struct tmc5240_dev *device, uint8_t reg_addr, uint32_t mask, uint32_t val)
 Read-modify-write a TMC5240 register.
 
int tmc5240_set_motion_profile (struct tmc5240_dev *device)
 Set motion profile parameters for the TMC5240 motor driver.
 
int tmc5240_get_target_pos (struct tmc5240_dev *device, int32_t *position)
 Get the target position of the motor.
 
int tmc5240_set_target_pos (struct tmc5240_dev *device, int32_t position)
 Set the target position for the TMC5240 motor driver.
 
int tmc5240_get_current_pos (struct tmc5240_dev *device, int32_t *position)
 Get the current position of the motor.
 
int tmc5240_set_current_pos (struct tmc5240_dev *device, int32_t position)
 Replace the current position of the motor with a new absolute position value.
 
int tmc5240_get_current_accel (struct tmc5240_dev *device, int32_t *acceleration)
 Get the current acceleration of the motor.
 
int tmc5240_get_current_vel (struct tmc5240_dev *device, int32_t *velocity)
 Get the current velocity of the motor.
 
int tmc5240_set_target_vel (struct tmc5240_dev *device, int32_t velocity)
 Set the target velocity for the TMC5240 motor driver.
 
int tmc5240_get_shaft_dir (struct tmc5240_dev *device, uint8_t *dir)
 Get the shaft direction setting from the TMC5240 device.
 
int tmc5240_set_shaft_dir (struct tmc5240_dev *device, uint8_t dir)
 Set the shaft direction for the TMC5240 device.
 
int tmc5240_get_amax (struct tmc5240_dev *device, int32_t *amax)
 Get the maximum acceleration (AMAX) value.
 
int tmc5240_set_amax (struct tmc5240_dev *device, int32_t amax)
 Set the maximum acceleration (AMAX) value.
 
int tmc5240_get_vmax (struct tmc5240_dev *device, int32_t *vmax)
 Get the maximum velocity (VMAX) value.
 
int tmc5240_set_vmax (struct tmc5240_dev *device, int32_t vmax)
 Set the maximum velocity (VMAX) value.
 
int tmc5240_get_dmax (struct tmc5240_dev *device, int32_t *dmax)
 Get the maximum deceleration (DMAX) value.
 
int tmc5240_set_dmax (struct tmc5240_dev *device, int32_t dmax)
 Set the maximum deceleration (DMAX) value.
 
int tmc5240_get_vstart (struct tmc5240_dev *device, int32_t *vstart)
 Get the start velocity (VSTART) value.
 
int tmc5240_set_vstart (struct tmc5240_dev *device, int32_t vstart)
 Set the start velocity (VSTART) value.
 
int tmc5240_get_a1 (struct tmc5240_dev *device, int32_t *a1)
 Get the first acceleration phase (A1) value.
 
int tmc5240_set_a1 (struct tmc5240_dev *device, int32_t a1)
 Set the first acceleration phase (A1) value.
 
int tmc5240_get_v1 (struct tmc5240_dev *device, int32_t *v1)
 Get the first velocity threshold (V1) value.
 
int tmc5240_set_v1 (struct tmc5240_dev *device, int32_t v1)
 Set the first velocity threshold (V1) value.
 
int tmc5240_get_a2 (struct tmc5240_dev *device, int32_t *a2)
 Get the second acceleration phase (A2) value.
 
int tmc5240_set_a2 (struct tmc5240_dev *device, int32_t a2)
 Set the second acceleration phase (A2) value.
 
int tmc5240_get_v2 (struct tmc5240_dev *device, int32_t *v2)
 Get the second velocity threshold (V2) value.
 
int tmc5240_set_v2 (struct tmc5240_dev *device, int32_t v2)
 Set the second velocity threshold (V2) value.
 
int tmc5240_get_d1 (struct tmc5240_dev *device, int32_t *d1)
 Get the first deceleration phase (D1) value.
 
int tmc5240_set_d1 (struct tmc5240_dev *device, int32_t d1)
 Set the first deceleration phase (D1) value.
 
int tmc5240_get_d2 (struct tmc5240_dev *device, int32_t *d2)
 Get the second deceleration phase (D2) value.
 
int tmc5240_set_d2 (struct tmc5240_dev *device, int32_t d2)
 Set the second deceleration phase (D2) value.
 
int tmc5240_get_vstop (struct tmc5240_dev *device, int32_t *vstop)
 Get the stop velocity (VSTOP) value.
 
int tmc5240_set_vstop (struct tmc5240_dev *device, int32_t vstop)
 Set the stop velocity (VSTOP) value.
 
int tmc5240_get_rampmode (struct tmc5240_dev *device, int32_t *rampmode)
 Get the ramp mode configuration.
 
int tmc5240_set_rampmode (struct tmc5240_dev *device, int32_t rampmode)
 Set the ramp mode configuration.
 
int tmc5240_stop (struct tmc5240_dev *device)
 Stop the motor by setting VMAX to 0.
 

Detailed Description

Header file for TMC5240 driver.

Author
Kister Genesis Jimenez (kiste.nosp@m.r.ji.nosp@m.menez.nosp@m.@ana.nosp@m.log.c.nosp@m.om)

Copyright 2026(c) Analog Devices, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ TMC5240_DEFAULT_D1

#define TMC5240_DEFAULT_D1   10

◆ TMC5240_DEFAULT_D2

#define TMC5240_DEFAULT_D2   10

◆ TMC5240_DEFAULT_VSTOP

#define TMC5240_DEFAULT_VSTOP   10

Function Documentation

◆ tmc5240_get_a1()

int tmc5240_get_a1 ( struct tmc5240_dev * device,
int32_t * a1 )

Get the first acceleration phase (A1) value.

Get first acceleration phase

Parameters
device- Pointer to the TMC5240 device structure.
a1- Pointer to store the retrieved A1 value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_a2()

int tmc5240_get_a2 ( struct tmc5240_dev * device,
int32_t * a2 )

Get the second acceleration phase (A2) value.

Get second acceleration phase

Parameters
device- Pointer to the TMC5240 device structure.
a2- Pointer to store the retrieved A2 value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_amax()

int tmc5240_get_amax ( struct tmc5240_dev * device,
int32_t * amax )

Get the maximum acceleration (AMAX) value.

Get maximum acceleration

Parameters
device- Pointer to the TMC5240 device structure.
amax- Pointer to store the retrieved AMAX value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_current_accel()

int tmc5240_get_current_accel ( struct tmc5240_dev * device,
int32_t * acceleration )

Get the current acceleration of the motor.

Get current acceleration

This function reads the actual acceleration value from the TMC5240 device.

Parameters
device- Pointer to the TMC5240 device structure.
acceleration- Pointer to store the read acceleration value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_current_pos()

int tmc5240_get_current_pos ( struct tmc5240_dev * device,
int32_t * position )

Get the current position of the motor.

Get current position

This function reads the actual position register (XACTUAL) from the TMC5240 device and stores the result in the provided position pointer.

Parameters
device- Pointer to the TMC5240 device structure.
position- Pointer to store the current motor position value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_current_vel()

int tmc5240_get_current_vel ( struct tmc5240_dev * device,
int32_t * velocity )

Get the current velocity of the motor.

Get current velocity

This function reads the actual velocity register (VACTUAL) from the TMC5240 device and returns the velocity value as a signed 24-bit integer converted to 32-bit format.

Parameters
device- Pointer to the TMC5240 device structure.
velocity- Pointer to store the current velocity value. The value is sign-extended from 24-bit to 32-bit.
Returns
0 on success, negative error code otherwise.

◆ tmc5240_get_d1()

int tmc5240_get_d1 ( struct tmc5240_dev * device,
int32_t * d1 )

Get the first deceleration phase (D1) value.

Get first deceleration phase

Parameters
device- Pointer to the TMC5240 device structure.
d1- Pointer to store the retrieved D1 value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_d2()

int tmc5240_get_d2 ( struct tmc5240_dev * device,
int32_t * d2 )

Get the second deceleration phase (D2) value.

Get second deceleration phase

Parameters
device- Pointer to the TMC5240 device structure.
d2- Pointer to store the retrieved D2 value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_dmax()

int tmc5240_get_dmax ( struct tmc5240_dev * device,
int32_t * dmax )

Get the maximum deceleration (DMAX) value.

Get maximum deceleration

Parameters
device- Pointer to the TMC5240 device structure.
dmax- Pointer to store the retrieved DMAX value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_rampmode()

int tmc5240_get_rampmode ( struct tmc5240_dev * device,
int32_t * rampmode )

Get the ramp mode configuration.

Get ramp mode

Parameters
device- Pointer to the TMC5240 device structure.
rampmode- Pointer to store the retrieved ramp mode value. Possible values:
  • 0: Position mode
  • 1: Positive velocity mode
  • 2: Negative velocity mode
  • 3: Hold mode
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_shaft_dir()

int tmc5240_get_shaft_dir ( struct tmc5240_dev * device,
uint8_t * dir )

Get the shaft direction setting from the TMC5240 device.

Get shaft direction

This function reads the GCONF register and extracts the shaft direction bit. The shaft direction determines whether the motor rotates in normal or inverted direction.

Parameters
device- Pointer to the TMC5240 device structure
dir- Pointer to store the shaft direction value:
  • 0: Normal direction
  • 1: Reverse direction
Returns
0 on success, negative error code otherwise

◆ tmc5240_get_target_pos()

int tmc5240_get_target_pos ( struct tmc5240_dev * device,
int32_t * position )

Get the target position of the motor.

Get target position

This function reads the target position register (XTARGET) from the TMC5240 device and stores the result in the provided position pointer. The target position represents the desired destination when operating in position mode.

Parameters
device- Pointer to the TMC5240 device structure.
position- Pointer to store the target position value in microsteps.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_v1()

int tmc5240_get_v1 ( struct tmc5240_dev * device,
int32_t * v1 )

Get the first velocity threshold (V1) value.

Get first velocity threshold

Parameters
device- Pointer to the TMC5240 device structure.
v1- Pointer to store the retrieved V1 value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_v2()

int tmc5240_get_v2 ( struct tmc5240_dev * device,
int32_t * v2 )

Get the second velocity threshold (V2) value.

Get second velocity threshold

Parameters
device- Pointer to the TMC5240 device structure.
v2- Pointer to store the retrieved V2 value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_vmax()

int tmc5240_get_vmax ( struct tmc5240_dev * device,
int32_t * vmax )

Get the maximum velocity (VMAX) value.

Get maximum velocity

Parameters
device- Pointer to the TMC5240 device structure.
vmax- Pointer to store the retrieved VMAX value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_vstart()

int tmc5240_get_vstart ( struct tmc5240_dev * device,
int32_t * vstart )

Get the start velocity (VSTART) value.

Get start velocity

Parameters
device- Pointer to the TMC5240 device structure.
vstart- Pointer to store the retrieved VSTART value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_get_vstop()

int tmc5240_get_vstop ( struct tmc5240_dev * device,
int32_t * vstop )

Get the stop velocity (VSTOP) value.

Get stop velocity

Parameters
device- Pointer to the TMC5240 device structure.
vstop- Pointer to store the retrieved VSTOP value.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_init()

int tmc5240_init ( struct tmc5240_dev ** device,
struct tmc5240_init_param * init_param )

Initialize the TMC5240 device.

Initialize the TMC5240 device

Parameters
device- TMC5240 device descriptor
init_param- Initialization parameter containing information about the TMC5240 device to be initialized.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ tmc5240_reg_read()

int tmc5240_reg_read ( struct tmc5240_dev * device,
uint8_t reg_addr,
uint32_t * reg_data )

Reads data from a given TMC5240 Register.

Read from a TMC5240 register

This function wraps the TMC-API readRegister function to read data from a specified register of the TMC5240 device.

Parameters
device- The device structure.
reg_addr- Address of the register.
reg_data- Stores data read from the register.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_reg_update()

int tmc5240_reg_update ( struct tmc5240_dev * device,
uint8_t reg_addr,
uint32_t mask,
uint32_t val )

Read-modify-write a TMC5240 register.

Read-modify-write a TMC5240 register field

This function reads the current value of a register, clears the bits specified by the mask, sets new bits from val prepared with the same mask, and writes the result back.

Parameters
device- Pointer to the TMC5240 device structure.
reg_addr- Address of the register.
mask- Bitmask of the field(s) to update.
val- New value for the field, pre-shifted to the correct position.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_reg_write()

int tmc5240_reg_write ( struct tmc5240_dev * device,
uint8_t reg_addr,
uint32_t reg_data )

Writes data to a given TMC5240 Register.

Write to a TMC5240 register

This function wraps the TMC-API writeRegister function to write data to a specified register of the TMC5240 device.

Parameters
device- The device structure.
reg_addr- Address of the register to write to.
reg_data- 32-bit data value to write to the register.
Returns
0 in case of success, negative error code otherwise.
Note
The TMC-API writeRegister function does not return error codes. Any SPI communication errors are logged in tmc5240_readWriteSPI() but cannot be propagated back through this function. This is a limitation of the TMC-API callback interface.
Here is the caller graph for this function:

◆ tmc5240_remove()

int tmc5240_remove ( struct tmc5240_dev * device)

Free the resources allocated by the tmc5240_init()

Free resources allocated by tmc5240_init()

Parameters
device- TMC5240 device descriptor
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ tmc5240_set_a1()

int tmc5240_set_a1 ( struct tmc5240_dev * device,
int32_t a1 )

Set the first acceleration phase (A1) value.

Set first acceleration phase

Parameters
device- Pointer to the TMC5240 device structure.
a1- The A1 value to set.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_set_a2()

int tmc5240_set_a2 ( struct tmc5240_dev * device,
int32_t a2 )

Set the second acceleration phase (A2) value.

Set second acceleration phase

Parameters
device- Pointer to the TMC5240 device structure.
a2- The A2 value to set.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_set_amax()

int tmc5240_set_amax ( struct tmc5240_dev * device,
int32_t amax )

Set the maximum acceleration (AMAX) value.

Set maximum acceleration

Parameters
device- Pointer to the TMC5240 device structure.
amax- The AMAX value to set.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_set_current_pos()

int tmc5240_set_current_pos ( struct tmc5240_dev * device,
int32_t position )

Replace the current position of the motor with a new absolute position value.

Set current position

This function sets the motor's current position register (XACTUAL) to a specified value. Before updating the position, it switches the motor to hold mode (RAMPMODE = MODE_HOLD) to ensure the position can be safely updated without triggering unwanted motion. This is useful for rehoming or synchronizing the motor's internal position counter with an external reference system.

Parameters
device- Pointer to the TMC5240 device structure.
position- The new position value to set in microsteps.
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_set_d1()

int tmc5240_set_d1 ( struct tmc5240_dev * device,
int32_t d1 )

Set the first deceleration phase (D1) value.

Set first deceleration phase

Parameters
device- Pointer to the TMC5240 device structure.
d1- The D1 value to set.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_set_d2()

int tmc5240_set_d2 ( struct tmc5240_dev * device,
int32_t d2 )

Set the second deceleration phase (D2) value.

Set second deceleration phase

Parameters
device- Pointer to the TMC5240 device structure.
d2- The D2 value to set.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_set_dmax()

int tmc5240_set_dmax ( struct tmc5240_dev * device,
int32_t dmax )

Set the maximum deceleration (DMAX) value.

Set maximum deceleration

Parameters
device- Pointer to the TMC5240 device structure.
dmax- The DMAX value to set.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_set_motion_profile()

int tmc5240_set_motion_profile ( struct tmc5240_dev * device)

Set motion profile parameters for the TMC5240 motor driver.

Set motion profile parameters

This function configures all motion profile parameters including multi-phase acceleration and deceleration settings. It applies default values for d1, d2, and vstop if they are zero, and ensures vstop is not less than vstart.

Parameters
device- Pointer to the TMC5240 device structure.
Returns
0 on success, negative error code on failure.
Here is the caller graph for this function:

◆ tmc5240_set_rampmode()

int tmc5240_set_rampmode ( struct tmc5240_dev * device,
int32_t rampmode )

Set the ramp mode configuration.

Set ramp mode

Parameters
device- Pointer to the TMC5240 device structure.
rampmode- The ramp mode value to set. Possible values:
  • 0: Position mode
  • 1: Positive velocity mode
  • 2: Negative velocity mode
  • 3: Hold mode
Returns
0 in case of success, negative error code otherwise.

◆ tmc5240_set_shaft_dir()

int tmc5240_set_shaft_dir ( struct tmc5240_dev * device,
uint8_t dir )

Set the shaft direction for the TMC5240 device.

Set shaft direction

This function modifies the GCONF register to set the shaft direction bit. Setting the shaft direction allows reversing the motor rotation direction without changing the wiring.

Parameters
device- Pointer to the TMC5240 device structure
dir- Shaft direction value to set:
  • 0: Normal direction
    • 1: Reverse direction
Returns
0 on success, negative error code otherwise

◆ tmc5240_set_target_pos()

int tmc5240_set_target_pos ( struct tmc5240_dev * device,
int32_t position )

Set the target position for the TMC5240 motor driver.

Set target position

This function configures the TMC5240 to move to a specified target position in position mode. It ensures that the acceleration (AMAX) and maximum velocity (VMAX) parameters are properly configured before setting the target. If either AMAX or VMAX is zero, the function restores them to the device's stored default values to enable motion. The motor will ramp up to VMAX, move toward the target, and decelerate according to the configured motion profile.

Parameters
device- Pointer to the TMC5240 device structure.
position- Target position value to move to in microsteps.
Returns
0 on success, negative error code on failure.

◆ tmc5240_set_target_vel()

int tmc5240_set_target_vel ( struct tmc5240_dev * device,
int32_t velocity )

Set the target velocity for the TMC5240 motor driver.

Set target velocity

This function sets the target velocity for the motor by configuring the VMAX register and the appropriate ramp mode (positive or negative velocity). If the maximum acceleration (AMAX) is zero, it will be set to the device's default value before setting the velocity.

Parameters
device- Pointer to the TMC5240 device structure.
velocity- Target velocity value. Positive values result in positive velocity ramp mode, negative values result in negative velocity ramp mode. The absolute value is written to VMAX.
Returns
0 on success, negative error code otherwise.

◆ tmc5240_set_v1()

int tmc5240_set_v1 ( struct tmc5240_dev * device,
int32_t v1 )

Set the first velocity threshold (V1) value.

Set first velocity threshold

Parameters
device- Pointer to the TMC5240 device structure.
v1- The V1 value to set.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_set_v2()

int tmc5240_set_v2 ( struct tmc5240_dev * device,
int32_t v2 )

Set the second velocity threshold (V2) value.

Set second velocity threshold

Parameters
device- Pointer to the TMC5240 device structure.
v2- The V2 value to set.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_set_vmax()

int tmc5240_set_vmax ( struct tmc5240_dev * device,
int32_t vmax )

Set the maximum velocity (VMAX) value.

Set maximum velocity

Parameters
device- Pointer to the TMC5240 device structure.
vmax- The VMAX value to set.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_set_vstart()

int tmc5240_set_vstart ( struct tmc5240_dev * device,
int32_t vstart )

Set the start velocity (VSTART) value.

Set start velocity

Parameters
device- Pointer to the TMC5240 device structure.
vstart- The VSTART value to set.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_set_vstop()

int tmc5240_set_vstop ( struct tmc5240_dev * device,
int32_t vstop )

Set the stop velocity (VSTOP) value.

Set stop velocity

Parameters
device- Pointer to the TMC5240 device structure.
vstop- The VSTOP value to set.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ tmc5240_stop()

int tmc5240_stop ( struct tmc5240_dev * device)

Stop the motor by setting VMAX to 0.

Stop the motor

Parameters
device- Pointer to the TMC5240 device structure.
Returns
0 in case of success, negative error code otherwise.