HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
tmc51x0::ConfigBuilder Class Reference

Fluent configuration builder for DriverConfig. More...

#include <tmc51x0_config_builder.hpp>

Collaboration diagram for tmc51x0::ConfigBuilder:
[legend]

Public Member Functions

 ConfigBuilder ()=default
 Default constructor.
 
 ConfigBuilder (const DriverConfig &cfg)
 Construct from existing config.
 
ConfigBuilderWithMotorMa (uint16_t steps_per_rev, uint16_t rated_current_ma)
 Configure motor specifications.
 
ConfigBuilderWithRunCurrentMa (uint16_t run_current_ma)
 Set run current value.
 
ConfigBuilderWithHoldCurrentMa (uint16_t hold_current_ma)
 Set hold current value.
 
ConfigBuilderWithSupplyVoltageMv (uint32_t voltage_mv)
 Set supply voltage value.
 
ConfigBuilderWithSenseResistorMohm (uint32_t resistance_mohm)
 Set sense resistor value.
 
ConfigBuilderWithWindingResistanceMohm (uint32_t resistance_mohm)
 Set winding resistance value.
 
ConfigBuilderWithWindingInductanceMh (float inductance_mh)
 Set winding inductance value.
 
ConfigBuilderWithMotorPowerDownDelayMs (float delay_ms)
 Set motor power down delay time.
 
ConfigBuilderWithStepsPerRevolution (uint16_t steps)
 Set steps per revolution.
 
ConfigBuilderWithMosfetMillerChargeNc (float charge_nc)
 Set MOSFET Miller charge.
 
ConfigBuilderWithBbmTimeNs (uint32_t time_ns)
 Set Break Before Make time.
 
ConfigBuilderWithSenseFilter (SenseFilterTime filter_time)
 Set sense amplifier filter time.
 
ConfigBuilderWithOverTempProtection (OverTempProtection protection)
 Set over-temperature protection level.
 
ConfigBuilderWithS2vsVoltageMv (uint16_t voltage_mv)
 Set short to VS detector voltage threshold.
 
ConfigBuilderWithS2gVoltageMv (uint16_t voltage_mv)
 Set short to GND detector voltage threshold.
 
ConfigBuilderWithShortFilter (uint8_t filter)
 Set short detection filter bandwidth.
 
ConfigBuilderWithShortDetectionDelayUsX10 (uint8_t delay_us_x10)
 Set short detection delay.
 
ConfigBuilderWithChopperMode (ChopperMode mode)
 Set chopper mode.
 
ConfigBuilderWithChopperToff (uint8_t toff)
 Set chopper off-time (TOFF)
 
ConfigBuilderWithChopperBlankTime (ChopperBlankTime blank_time)
 Set chopper blank time.
 
ConfigBuilderWithHysteresisStart (uint8_t hstrt)
 Set hysteresis start value (SpreadCycle mode)
 
ConfigBuilderWithHysteresisEnd (uint8_t hend)
 Set hysteresis end value (SpreadCycle mode)
 
ConfigBuilderWithFastDecayTime (uint8_t tfd)
 Set fast decay time (Classic mode only)
 
ConfigBuilderWithPassiveFastDecayTime (uint8_t tpfd)
 Set passive fast decay time.
 
ConfigBuilderWithMicrostepResolution (MicrostepResolution mres)
 Set microstep resolution.
 
ConfigBuilderWithInterpolation (bool enable)
 Enable/disable interpolation.
 
ConfigBuilderWithStealthChop (bool enable)
 Enable/disable StealthChop.
 
ConfigBuilderWithStealthChopThreshold (const VelocityValue &velocity)
 Set StealthChop threshold velocity.
 
ConfigBuilderWithStealthChopPwmFreq (uint8_t freq)
 Set StealthChop PWM frequency.
 
ConfigBuilderWithStealthChopPwmOfs (uint8_t ofs)
 Set StealthChop PWM offset.
 
ConfigBuilderWithStealthChopAutoscale (bool enable)
 Enable/disable StealthChop PWM autoscale.
 
ConfigBuilderWithStealthChopAutograd (bool enable)
 Enable/disable StealthChop PWM autograd.
 
ConfigBuilderWithStallGuardThreshold (int8_t threshold)
 Set StallGuard2 threshold (SGT)
 
ConfigBuilderWithStallGuardFilter (bool enable)
 Enable/disable StallGuard2 filter.
 
ConfigBuilderWithStallGuardMinVelocity (float velocity, Unit unit=Unit::RPM)
 Set StallGuard2 minimum velocity threshold.
 
ConfigBuilderWithStallGuardMaxVelocity (float velocity, Unit unit=Unit::RPM)
 Set StallGuard2 maximum velocity threshold.
 
ConfigBuilderWithStallGuard (const StallGuardConfig &sg_config)
 Configure StallGuard2 with a complete config struct.
 
ConfigBuilderWithRecalibration (bool enable)
 Enable/disable recalibration.
 
ConfigBuilderWithShortStandstillTimeout (bool enable)
 Enable/disable short standstill timeout.
 
ConfigBuilderWithStealthChopStepFilter (bool enable)
 Enable/disable StealthChop step filter.
 
ConfigBuilderWithMaxSpeed (const VelocityValue &velocity)
 Set maximum velocity.
 
ConfigBuilderWithAcceleration (const AccelerationValue &acceleration)
 Set maximum acceleration.
 
ConfigBuilderWithDeceleration (const AccelerationValue &deceleration)
 Set maximum deceleration.
 
ConfigBuilderWithStartSpeed (const VelocityValue &velocity)
 Set start velocity.
 
ConfigBuilderWithStopSpeed (const VelocityValue &velocity)
 Set stop velocity.
 
ConfigBuilderWithVelocityThreshold (const VelocityValue &velocity)
 Set velocity threshold for acceleration/deceleration phase transition.
 
ConfigBuilderWithFirstAcceleration (const AccelerationValue &acceleration)
 Set first acceleration phase.
 
ConfigBuilderWithFirstDeceleration (const AccelerationValue &deceleration)
 Set first deceleration phase.
 
ConfigBuilderWithRampPowerDownDelayMs (float delay_ms)
 Set ramp power down delay.
 
ConfigBuilderWithZeroWaitTimeMs (float wait_ms)
 Set zero velocity wait time.
 
ConfigBuilderWithInternalClock ()
 Use internal clock (12MHz)
 
ConfigBuilderWithExternalClockHz (uint32_t frequency_hz)
 Use external clock.
 
ConfigBuilderWithDirectDrive ()
 Configure direct drive system.
 
ConfigBuilderWithGearbox (float gear_ratio)
 Configure gearbox system.
 
ConfigBuilderWithLeadScrew (float pitch_mm)
 Configure lead screw system.
 
ConfigBuilderWithBeltDrive (uint16_t pulley_teeth, float belt_pitch_mm)
 Configure belt drive system.
 
ConfigBuilderWithDirection (MotorDirection direction)
 Set motor direction.
 
DriverConfig Build () const
 Build the final configuration.
 
DriverConfigConfig ()
 Get mutable reference to config for advanced customization.
 
const DriverConfigConfig () const
 Get const reference to config.
 

Private Attributes

DriverConfig config_
 

Detailed Description

Fluent configuration builder for DriverConfig.

Provides a user-friendly interface for building TMC51x0 configurations with automatic unit conversions. All motor-specific presets are removed to allow users full control over configuration.

The builder ensures all DriverConfig fields are properly initialized, following the same pattern as ESP32 test config initialization.

Constructor & Destructor Documentation

◆ ConfigBuilder() [1/2]

tmc51x0::ConfigBuilder::ConfigBuilder ( )
default

Default constructor.

Creates a builder with default configuration values. All DriverConfig fields use their default constructors.

◆ ConfigBuilder() [2/2]

tmc51x0::ConfigBuilder::ConfigBuilder ( const DriverConfig & cfg)
inlineexplicit

Construct from existing config.

Parameters
cfgExisting DriverConfig to start from

Member Function Documentation

◆ Build()

DriverConfig tmc51x0::ConfigBuilder::Build ( ) const
inline

Build the final configuration.

Returns a complete DriverConfig with all fields properly initialized. The configuration follows the same pattern as ESP32 test config:

  • Motor configuration (motor_spec, chopper, stealthchop, ramp_config, global_config, direction, mechanical gear_ratio)
  • Board configuration (power_stage, sense_resistor_mohm, external_clk_config)
  • Platform configuration (mechanical system_type)
Returns
The built DriverConfig
Here is the caller graph for this function:

◆ Config() [1/2]

DriverConfig & tmc51x0::ConfigBuilder::Config ( )
inline

Get mutable reference to config for advanced customization.

Allows direct access to the internal config for advanced use cases where the fluent interface doesn't provide enough control.

Returns
Reference to internal config

◆ Config() [2/2]

const DriverConfig & tmc51x0::ConfigBuilder::Config ( ) const
inline

Get const reference to config.

Returns
Const reference to internal config

◆ WithAcceleration()

ConfigBuilder & tmc51x0::ConfigBuilder::WithAcceleration ( const AccelerationValue & acceleration)
inline

Set maximum acceleration.

Parameters
accelerationSelf-describing acceleration with unit
Returns
Reference to builder for chaining
builder.WithAcceleration({50.0f, Unit::RevPerSec});
builder.WithAcceleration(AccelerationValue::FromRevPerSec(50.0f));
@ RevPerSec
Revolutions per Second (recommended default for velocity)
static constexpr AccelerationValue FromRevPerSec(float v) noexcept
Definition tmc51x0_types.hpp:1828

◆ WithBbmTimeNs()

ConfigBuilder & tmc51x0::ConfigBuilder::WithBbmTimeNs ( uint32_t time_ns)
inline

Set Break Before Make time.

Parameters
time_nsBBM time in nanoseconds (0 = auto-calculate)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithBeltDrive()

ConfigBuilder & tmc51x0::ConfigBuilder::WithBeltDrive ( uint16_t pulley_teeth,
float belt_pitch_mm )
inline

Configure belt drive system.

Parameters
pulley_teethNumber of pulley teeth
belt_pitch_mmBelt pitch in mm (e.g., 2.0 for GT2)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithChopperBlankTime()

ConfigBuilder & tmc51x0::ConfigBuilder::WithChopperBlankTime ( ChopperBlankTime blank_time)
inline

Set chopper blank time.

Parameters
blank_timeBlank time (TBL_36CLK typical)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithChopperMode()

ConfigBuilder & tmc51x0::ConfigBuilder::WithChopperMode ( ChopperMode mode)
inline

Set chopper mode.

Parameters
modeChopper mode (SPREAD_CYCLE recommended)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithChopperToff()

ConfigBuilder & tmc51x0::ConfigBuilder::WithChopperToff ( uint8_t toff)
inline

Set chopper off-time (TOFF)

Parameters
toffOff-time value (0-15, 0=driver disable, 5=typical)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithDeceleration()

ConfigBuilder & tmc51x0::ConfigBuilder::WithDeceleration ( const AccelerationValue & deceleration)
inline

Set maximum deceleration.

Parameters
decelerationSelf-describing deceleration with unit
Returns
Reference to builder for chaining

◆ WithDirectDrive()

ConfigBuilder & tmc51x0::ConfigBuilder::WithDirectDrive ( )
inline

Configure direct drive system.

Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithDirection()

ConfigBuilder & tmc51x0::ConfigBuilder::WithDirection ( MotorDirection direction)
inline

Set motor direction.

Parameters
directionMotor direction (NORMAL or INVERSE)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithExternalClockHz()

ConfigBuilder & tmc51x0::ConfigBuilder::WithExternalClockHz ( uint32_t frequency_hz)
inline

Use external clock.

Parameters
frequency_hzExternal clock frequency in Hz
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithFastDecayTime()

ConfigBuilder & tmc51x0::ConfigBuilder::WithFastDecayTime ( uint8_t tfd)
inline

Set fast decay time (Classic mode only)

Parameters
tfdFast decay time (0-15, 0=slow decay only)
Returns
Reference to builder for chaining

◆ WithFirstAcceleration()

ConfigBuilder & tmc51x0::ConfigBuilder::WithFirstAcceleration ( const AccelerationValue & acceleration)
inline

Set first acceleration phase.

Parameters
accelerationSelf-describing acceleration with unit
Returns
Reference to builder for chaining

◆ WithFirstDeceleration()

ConfigBuilder & tmc51x0::ConfigBuilder::WithFirstDeceleration ( const AccelerationValue & deceleration)
inline

Set first deceleration phase.

Parameters
decelerationSelf-describing deceleration with unit
Returns
Reference to builder for chaining

◆ WithGearbox()

ConfigBuilder & tmc51x0::ConfigBuilder::WithGearbox ( float gear_ratio)
inline

Configure gearbox system.

Parameters
gear_ratioGear ratio (output/input, e.g., 5.18 for 5.18:1)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithHoldCurrentMa()

ConfigBuilder & tmc51x0::ConfigBuilder::WithHoldCurrentMa ( uint16_t hold_current_ma)
inline

Set hold current value.

Parameters
hold_current_maHold current in milliamps (0 = auto-calculate as 30% of run)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithHysteresisEnd()

ConfigBuilder & tmc51x0::ConfigBuilder::WithHysteresisEnd ( uint8_t hend)
inline

Set hysteresis end value (SpreadCycle mode)

Parameters
hendHysteresis end (0-15, 0=typical)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithHysteresisStart()

ConfigBuilder & tmc51x0::ConfigBuilder::WithHysteresisStart ( uint8_t hstrt)
inline

Set hysteresis start value (SpreadCycle mode)

Parameters
hstrtHysteresis start (0-7, 4=typical)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithInternalClock()

ConfigBuilder & tmc51x0::ConfigBuilder::WithInternalClock ( )
inline

Use internal clock (12MHz)

Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithInterpolation()

ConfigBuilder & tmc51x0::ConfigBuilder::WithInterpolation ( bool enable)
inline

Enable/disable interpolation.

Parameters
enableTrue to enable interpolation to 256 microsteps
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithLeadScrew()

ConfigBuilder & tmc51x0::ConfigBuilder::WithLeadScrew ( float pitch_mm)
inline

Configure lead screw system.

Parameters
pitch_mmLead screw pitch in mm
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithMaxSpeed()

ConfigBuilder & tmc51x0::ConfigBuilder::WithMaxSpeed ( const VelocityValue & velocity)
inline

Set maximum velocity.

Parameters
velocitySelf-describing velocity with unit
Returns
Reference to builder for chaining
builder.WithMaxSpeed({100.0f, Unit::RPM});
builder.WithMaxSpeed(VelocityValue::FromRPM(100.0f));
@ RPM
Revolutions per Minute (Velocity only, typically)
static constexpr VelocityValue FromRPM(float v) noexcept
Definition tmc51x0_types.hpp:1794

◆ WithMicrostepResolution()

ConfigBuilder & tmc51x0::ConfigBuilder::WithMicrostepResolution ( MicrostepResolution mres)
inline

Set microstep resolution.

Parameters
mresMicrostep resolution (MRES_256 typical)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithMosfetMillerChargeNc()

ConfigBuilder & tmc51x0::ConfigBuilder::WithMosfetMillerChargeNc ( float charge_nc)
inline

Set MOSFET Miller charge.

Used to calculate DRVSTRENGTH register.

Parameters
charge_ncMOSFET Miller charge in nanocoulombs (0 = auto-calculate)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithMotorMa()

ConfigBuilder & tmc51x0::ConfigBuilder::WithMotorMa ( uint16_t steps_per_rev,
uint16_t rated_current_ma )
inline

Configure motor specifications.

Sets basic motor parameters: steps per revolution and rated current.

Parameters
steps_per_revSteps per revolution (e.g., 200 for 1.8° motors)
rated_current_maRated motor current in milliamps (e.g., 1500 for 1.5A)
Returns
Reference to builder for chaining
builder.WithMotorMa(200, 1500); // 200 steps, 1500mA = 1.5A rated
Here is the caller graph for this function:

◆ WithMotorPowerDownDelayMs()

ConfigBuilder & tmc51x0::ConfigBuilder::WithMotorPowerDownDelayMs ( float delay_ms)
inline

Set motor power down delay time.

Controls the total delay time for motor power down after standstill. This is the IHOLDDELAY setting that controls the smooth transition from run current to hold current.

Parameters
delay_msTotal delay time in milliseconds (0 = instant)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithOverTempProtection()

ConfigBuilder & tmc51x0::ConfigBuilder::WithOverTempProtection ( OverTempProtection protection)
inline

Set over-temperature protection level.

Parameters
protectionOver-temperature protection level
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithPassiveFastDecayTime()

ConfigBuilder & tmc51x0::ConfigBuilder::WithPassiveFastDecayTime ( uint8_t tpfd)
inline

Set passive fast decay time.

Parameters
tpfdPassive fast decay time (0=disabled, 1-15)
Returns
Reference to builder for chaining

◆ WithRampPowerDownDelayMs()

ConfigBuilder & tmc51x0::ConfigBuilder::WithRampPowerDownDelayMs ( float delay_ms)
inline

Set ramp power down delay.

Sets the TPOWERDOWN delay - time before motor power down after standstill. This is different from motor power down delay (IHOLDDELAY).

Parameters
delay_msPower down delay in milliseconds
Returns
Reference to builder for chaining

◆ WithRecalibration()

ConfigBuilder & tmc51x0::ConfigBuilder::WithRecalibration ( bool enable)
inline

Enable/disable recalibration.

Parameters
enableTrue to enable recalibration
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithRunCurrentMa()

ConfigBuilder & tmc51x0::ConfigBuilder::WithRunCurrentMa ( uint16_t run_current_ma)
inline

Set run current value.

Parameters
run_current_maRun current in milliamps (0 = use rated current)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithS2gVoltageMv()

ConfigBuilder & tmc51x0::ConfigBuilder::WithS2gVoltageMv ( uint16_t voltage_mv)
inline

Set short to GND detector voltage threshold.

Parameters
voltage_mvVoltage threshold in millivolts (0 = auto-calculate)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithS2vsVoltageMv()

ConfigBuilder & tmc51x0::ConfigBuilder::WithS2vsVoltageMv ( uint16_t voltage_mv)
inline

Set short to VS detector voltage threshold.

Parameters
voltage_mvVoltage threshold in millivolts (0 = auto-calculate)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithSenseFilter()

ConfigBuilder & tmc51x0::ConfigBuilder::WithSenseFilter ( SenseFilterTime filter_time)
inline

Set sense amplifier filter time.

Parameters
filter_timeSense filter time constant
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithSenseResistorMohm()

ConfigBuilder & tmc51x0::ConfigBuilder::WithSenseResistorMohm ( uint32_t resistance_mohm)
inline

Set sense resistor value.

Required for automatic current calculation.

Parameters
resistance_mohmSense resistor in milliohms (e.g., 50 for 0.05Ω)
Returns
Reference to builder for chaining
builder.WithSenseResistorMohm(50); // 50mΩ = 0.05Ω
Here is the caller graph for this function:

◆ WithShortDetectionDelayUsX10()

ConfigBuilder & tmc51x0::ConfigBuilder::WithShortDetectionDelayUsX10 ( uint8_t delay_us_x10)
inline

Set short detection delay.

Parameters
delay_us_x10Delay in 0.1µs units (0 = auto-calculate)
Returns
Reference to builder for chaining

◆ WithShortFilter()

ConfigBuilder & tmc51x0::ConfigBuilder::WithShortFilter ( uint8_t filter)
inline

Set short detection filter bandwidth.

Parameters
filterFilter bandwidth (0-3, 0=lowest, 1=default)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithShortStandstillTimeout()

ConfigBuilder & tmc51x0::ConfigBuilder::WithShortStandstillTimeout ( bool enable)
inline

Enable/disable short standstill timeout.

Parameters
enableTrue to enable short standstill timeout
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithStallGuard()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStallGuard ( const StallGuardConfig & sg_config)
inline

Configure StallGuard2 with a complete config struct.

Sets all StallGuard parameters at once.

Parameters
sg_configComplete StallGuard configuration
Returns
Reference to builder for chaining
sg.threshold = -5;
sg.enable_filter = false;
sg.min_velocity = 20.0f;
sg.velocity_unit = Unit::RPM;
builder.WithStallGuard(sg);
StallGuard2 configuration structure.
Definition tmc51x0_types.hpp:1519
int8_t threshold
StallGuard2 threshold value.
Definition tmc51x0_types.hpp:1534

◆ WithStallGuardFilter()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStallGuardFilter ( bool enable)
inline

Enable/disable StallGuard2 filter.

Filter reduces measurement rate to one per electrical period (4 fullsteps).

Parameters
enableTrue to enable filter (smoother, recommended for CoolStep), False to disable (faster response, recommended for homing)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithStallGuardMaxVelocity()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStallGuardMaxVelocity ( float velocity,
Unit unit = Unit::RPM )
inline

Set StallGuard2 maximum velocity threshold.

StallGuard is disabled above this velocity. Set to 0 to disable limit.

Parameters
velocityMaximum velocity value (0 = no limit)
unitVelocity unit (default: RPM)
Returns
Reference to builder for chaining

◆ WithStallGuardMinVelocity()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStallGuardMinVelocity ( float velocity,
Unit unit = Unit::RPM )
inline

Set StallGuard2 minimum velocity threshold.

StallGuard readings are only valid above this velocity. Below this speed, stall detection is unreliable.

Parameters
velocityMinimum velocity value
unitVelocity unit (default: RPM)
Returns
Reference to builder for chaining
builder.WithStallGuardMinVelocity(20.0f, Unit::RPM); // 20 RPM minimum
Here is the caller graph for this function:

◆ WithStallGuardThreshold()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStallGuardThreshold ( int8_t threshold)
inline

Set StallGuard2 threshold (SGT)

Controls StallGuard2 sensitivity for stall detection.

Parameters
thresholdSGT value (-64 to +63)
  • Lower values: Higher sensitivity (detects stalls easier)
  • Higher values: Lower sensitivity (needs more torque to detect)
  • 0: Starting value, works with most motors
Returns
Reference to builder for chaining
builder.WithStallGuardThreshold(10); // Less sensitive
builder.WithStallGuardThreshold(-10); // More sensitive
Here is the caller graph for this function:

◆ WithStartSpeed()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStartSpeed ( const VelocityValue & velocity)
inline

Set start velocity.

Parameters
velocitySelf-describing velocity with unit
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithStealthChop()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStealthChop ( bool enable)
inline

Enable/disable StealthChop.

Parameters
enableTrue to enable StealthChop, false for SpreadCycle
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithStealthChopAutograd()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStealthChopAutograd ( bool enable)
inline

Enable/disable StealthChop PWM autograd.

Parameters
enableTrue to enable automatic PWM gradient calibration
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithStealthChopAutoscale()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStealthChopAutoscale ( bool enable)
inline

Enable/disable StealthChop PWM autoscale.

Parameters
enableTrue to enable automatic PWM amplitude calibration
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithStealthChopPwmFreq()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStealthChopPwmFreq ( uint8_t freq)
inline

Set StealthChop PWM frequency.

Parameters
freqPWM frequency (0-3, 1=~35kHz typical)
Returns
Reference to builder for chaining

◆ WithStealthChopPwmOfs()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStealthChopPwmOfs ( uint8_t ofs)
inline

Set StealthChop PWM offset.

Parameters
ofsPWM offset (0-255, 20-40 typical)
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithStealthChopStepFilter()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStealthChopStepFilter ( bool enable)
inline

Enable/disable StealthChop step filter.

Parameters
enableTrue to enable step filter for StealthChop
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithStealthChopThreshold()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStealthChopThreshold ( const VelocityValue & velocity)
inline

Set StealthChop threshold velocity.

Velocity below which StealthChop is active, above which SpreadCycle is used.

Parameters
velocityThreshold velocity with unit
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithStepsPerRevolution()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStepsPerRevolution ( uint16_t steps)
inline

Set steps per revolution.

Parameters
stepsSteps per revolution (e.g., 200 for 1.8° motor)
Returns
Reference to builder for chaining

◆ WithStopSpeed()

ConfigBuilder & tmc51x0::ConfigBuilder::WithStopSpeed ( const VelocityValue & velocity)
inline

Set stop velocity.

Parameters
velocitySelf-describing velocity with unit
Returns
Reference to builder for chaining

◆ WithSupplyVoltageMv()

ConfigBuilder & tmc51x0::ConfigBuilder::WithSupplyVoltageMv ( uint32_t voltage_mv)
inline

Set supply voltage value.

Parameters
voltage_mvSupply voltage in millivolts (e.g., 24000 for 24V)
Returns
Reference to builder for chaining
builder.WithSupplyVoltageMv(24000); // 24000mV = 24V
Here is the caller graph for this function:

◆ WithVelocityThreshold()

ConfigBuilder & tmc51x0::ConfigBuilder::WithVelocityThreshold ( const VelocityValue & velocity)
inline

Set velocity threshold for acceleration/deceleration phase transition.

Parameters
velocitySelf-describing velocity with unit
Returns
Reference to builder for chaining

◆ WithWindingInductanceMh()

ConfigBuilder & tmc51x0::ConfigBuilder::WithWindingInductanceMh ( float inductance_mh)
inline

Set winding inductance value.

Used for StealthChop configuration.

Parameters
inductance_mhWinding inductance in millihenries
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithWindingResistanceMohm()

ConfigBuilder & tmc51x0::ConfigBuilder::WithWindingResistanceMohm ( uint32_t resistance_mohm)
inline

Set winding resistance value.

Required for StealthChop lower limit calculation.

Parameters
resistance_mohmWinding resistance in milliohms
Returns
Reference to builder for chaining
Here is the caller graph for this function:

◆ WithZeroWaitTimeMs()

ConfigBuilder & tmc51x0::ConfigBuilder::WithZeroWaitTimeMs ( float wait_ms)
inline

Set zero velocity wait time.

Parameters
wait_msWait time at zero velocity in milliseconds
Returns
Reference to builder for chaining
Here is the caller graph for this function:

Member Data Documentation

◆ config_

DriverConfig tmc51x0::ConfigBuilder::config_
private

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