HF-TMC9660 Driver 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC9660
Loading...
Searching...
No Matches
tmc9660::TMC9660< CommType >::Ramp Struct Reference

Hardware 8-segment acceleration/dec-acc profile controller. More...

#include <tmc9660.hpp>

Collaboration diagram for tmc9660::TMC9660< CommType >::Ramp:
[legend]

Classes

struct  RampConfig
 Configuration structure for ramp auto-configuration. More...
 

Public Member Functions

bool enable (bool on) noexcept
 Enable or disable the ramp generator block.
 
bool setAcceleration (uint32_t a1, uint32_t a2, uint32_t a_max) noexcept
 Set acceleration segments A1, A2, Amax (µ units/s²).
 
bool setDeceleration (uint32_t d1, uint32_t d2, uint32_t d_max) noexcept
 Set deceleration segments D1, D2, Dmax (µ units/s²).
 
bool setVelocities (uint32_t v_start, uint32_t v_stop, uint32_t v1, uint32_t v2, uint32_t v_max) noexcept
 Configure velocity thresholds and limits.
 
bool setTiming (uint16_t t_vmax_cycles, uint16_t t_zero_wait_cycles) noexcept
 Timing constraints at Vmax and between moves.
 
bool enableFeedForward (bool enable_vel_ff, bool enable_accel_ff, uint16_t accel_ff_gain, tmc9660::tmcl::AccelerationFFShift accel_ff_shift) noexcept
 Enable hardware feed-forward terms and set gain/shift.
 
bool setDirectVelocityMode (bool enable) noexcept
 Direct-velocity mode instead of classic PI velocity loop.
 
bool getRampVelocity (int32_t &velocity) noexcept
 Get the current target velocity calculated by the ramp controller.
 
bool getRampPosition (int32_t &position) noexcept
 Get the current target position calculated by the ramp controller.
 
bool configureAuto (const RampConfig &config) noexcept
 Auto-configure ramp parameters.
 

Private Member Functions

 Ramp (TMC9660 &parent) noexcept
 

Private Attributes

TMC9660driver
 

Friends

class TMC9660
 

Detailed Description

template<typename CommType>
struct tmc9660::TMC9660< CommType >::Ramp

Hardware 8-segment acceleration/dec-acc profile controller.

Covers all ramp generator and feedforward parameters:

  • ACCELERATION_FF_GAIN (50)
  • ACCELERATION_FF_SHIFT (51)
  • RAMP_ENABLE (52)
  • DIRECT_VELOCITY_MODE (53)
  • RAMP_AMAX/A1/A2 (54/55/56)
  • RAMP_DMAX/D1/D2 (57/58/59)
  • RAMP_VMAX/V1/V2/VSTART/VSTOP (60/61/62/63/64)
  • RAMP_TVMAX/TZEROWAIT (65/66)
  • ACCELERATION_FEEDFORWARD_ENABLE (67)
  • VELOCITY_FEEDFORWARD_ENABLE (68)
  • RAMP_VELOCITY (69)
  • RAMP_POSITION (70)

Constructor & Destructor Documentation

◆ Ramp()

template<typename CommType >
tmc9660::TMC9660< CommType >::Ramp::Ramp ( TMC9660 & parent)
inlineexplicitprivatenoexcept

Member Function Documentation

◆ configureAuto()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::Ramp::configureAuto ( const RampConfig & config)
noexcept

Auto-configure ramp parameters.

Configures acceleration, deceleration, velocity thresholds, and feedforward parameters based on high-level motion profile requirements.

Parameters
configRamp configuration (see RampConfig)
Returns
true if all configurations succeeded, false otherwise

◆ enable()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::Ramp::enable ( bool on)
noexcept

Enable or disable the ramp generator block.

Parameters
onTrue to enable, false to disable (RAMP_ENABLE).

◆ enableFeedForward()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::Ramp::enableFeedForward ( bool enable_vel_ff,
bool enable_accel_ff,
uint16_t accel_ff_gain,
tmc9660::tmcl::AccelerationFFShift accel_ff_shift )
noexcept

Enable hardware feed-forward terms and set gain/shift.

This allows the ramp generator to use feed-forward terms for velocity and acceleration.

Parameters
enable_vel_ffEnable the VELOCITY_FEEDFORWARD feature (VELOCITY_FEEDFORWARD_ENABLE)
enable_accel_ffEnable the ACCELERATION_FEEDFORWARD feature (ACCELERATION_FEEDFORWARD_ENABLE)
accel_ff_gainACCELERATION_FF_GAIN (0…65535)
accel_ff_shiftACCELERATION_FF_SHIFT enum (tmc9660::tmcl::AccelerationFFShift)

◆ getRampPosition()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::Ramp::getRampPosition ( int32_t & position)
noexcept

Get the current target position calculated by the ramp controller.

Parameters
[out]positionThe current ramp target position (RAMP_POSITION, param 70)
Returns
true if the value was read successfully.

◆ getRampVelocity()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::Ramp::getRampVelocity ( int32_t & velocity)
noexcept

Get the current target velocity calculated by the ramp controller.

Parameters
[out]velocityThe current ramp target velocity (RAMP_VELOCITY, param 69)
Returns
true if the value was read successfully.

◆ setAcceleration()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::Ramp::setAcceleration ( uint32_t a1,
uint32_t a2,
uint32_t a_max )
noexcept

Set acceleration segments A1, A2, Amax (µ units/s²).

Parameters
a1First acceleration (RAMP_A1)
a2Second acceleration (RAMP_A2)
a_maxTop acceleration (RAMP_AMAX)

◆ setDeceleration()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::Ramp::setDeceleration ( uint32_t d1,
uint32_t d2,
uint32_t d_max )
noexcept

Set deceleration segments D1, D2, Dmax (µ units/s²).

Parameters
d1Second deceleration (RAMP_D1)
d2First deceleration (RAMP_D2)
d_maxTop deceleration (RAMP_DMAX)

◆ setDirectVelocityMode()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::Ramp::setDirectVelocityMode ( bool enable)
noexcept

Direct-velocity mode instead of classic PI velocity loop.

Parameters
enableTrue to enable direct velocity mode (DIRECT_VELOCITY_MODE)

◆ setTiming()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::Ramp::setTiming ( uint16_t t_vmax_cycles,
uint16_t t_zero_wait_cycles )
noexcept

Timing constraints at Vmax and between moves.

Parameters
t_vmax_cyclesMinimum time at VMAX (RAMP_TVMAX)
t_zero_wait_cyclesWait time at end of ramp (RAMP_TZEROWAIT)

◆ setVelocities()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::Ramp::setVelocities ( uint32_t v_start,
uint32_t v_stop,
uint32_t v1,
uint32_t v2,
uint32_t v_max )
noexcept

Configure velocity thresholds and limits.

Parameters
v_startStart velocity (RAMP_VSTART)
v_stopStop velocity (RAMP_VSTOP)
v1Velocity threshold 1 (RAMP_V1)
v2Velocity threshold 2 (RAMP_V2)
v_maxMaximum velocity (RAMP_VMAX)

Friends And Related Symbol Documentation

◆ TMC9660

template<typename CommType >
friend class TMC9660
friend

Member Data Documentation

◆ driver

template<typename CommType >
TMC9660& tmc9660::TMC9660< CommType >::Ramp::driver
private

The documentation for this struct was generated from the following file: