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

Reference switch configuration structure. More...

#include <tmc51x0_types.hpp>

Public Member Functions

 ReferenceSwitchConfig ()=default
 Default constructor.
 

Public Attributes

ReferenceSwitchActiveLevel left_switch_active
 
ReferenceSwitchActiveLevel right_switch_active
 
bool left_switch_stop_enable
 
bool right_switch_stop_enable
 
ReferenceStopMode stop_mode
 Stop mode (hard or soft) - only applies if stop is enabled.
 
bool swap_left_right {false}
 Swap left and right switch inputs (useful for reversed wiring)
 
ReferenceLatchMode latch_left {ReferenceLatchMode::DISABLED}
 Left switch latching mode (must be explicitly set)
 
ReferenceLatchMode latch_right {ReferenceLatchMode::DISABLED}
 Right switch latching mode (must be explicitly set)
 
bool en_latch_encoder {false}
 Latch encoder position on switch event (for encoder N-channel as third switch)
 

Detailed Description

Reference switch configuration structure.

Configuration parameters for reference switches/endstops used for homing and limit detection. Supports both mechanical switches and encoder N-channel as a third switch option.

Note
For reliable homing, follow the complete procedure:
  1. Move away from switch (ensure switch is not pressed)
  2. Configure switches with appropriate active level and stop mode
  3. Start motion toward switch
  4. Wait for standstill after switch hit
  5. Calculate position offset and set home position
See also
Datasheet section 12.4: Reference Switches

Constructor & Destructor Documentation

◆ ReferenceSwitchConfig()

tmc51x0::ReferenceSwitchConfig::ReferenceSwitchConfig ( )
default

Default constructor.

Initializes with safe defaults:

  • Active level: ACTIVE_LOW (failsafe)
  • Stop enable: false (motor doesn't stop)
  • Latching: DISABLED (no latching)
  • Stop mode: SOFT_STOP

Member Data Documentation

◆ en_latch_encoder

bool tmc51x0::ReferenceSwitchConfig::en_latch_encoder {false}

Latch encoder position on switch event (for encoder N-channel as third switch)

◆ latch_left

ReferenceLatchMode tmc51x0::ReferenceSwitchConfig::latch_left {ReferenceLatchMode::DISABLED}

Left switch latching mode (must be explicitly set)

◆ latch_right

ReferenceLatchMode tmc51x0::ReferenceSwitchConfig::latch_right {ReferenceLatchMode::DISABLED}

Right switch latching mode (must be explicitly set)

◆ left_switch_active

ReferenceSwitchActiveLevel tmc51x0::ReferenceSwitchConfig::left_switch_active
Initial value:

Left switch active level (REFL) ACTIVE_LOW = active when LOW (inverted polarity), ACTIVE_HIGH = active when HIGH (normal polarity)

◆ left_switch_stop_enable

bool tmc51x0::ReferenceSwitchConfig::left_switch_stop_enable
Initial value:
{
false}

Enable automatic motor stop on left switch (independent of active level) true = stop motor when switch is active, false = don't stop (but can still latch/read switch state)

◆ right_switch_active

ReferenceSwitchActiveLevel tmc51x0::ReferenceSwitchConfig::right_switch_active
Initial value:

Right switch active level (REFR) ACTIVE_LOW = active when LOW (inverted polarity), ACTIVE_HIGH = active when HIGH (normal polarity)

◆ right_switch_stop_enable

bool tmc51x0::ReferenceSwitchConfig::right_switch_stop_enable
Initial value:
{
false}

Enable automatic motor stop on right switch (independent of active level) true = stop motor when switch is active, false = don't stop (but can still latch/read switch state)

◆ stop_mode

ReferenceStopMode tmc51x0::ReferenceSwitchConfig::stop_mode
Initial value:

Stop mode (hard or soft) - only applies if stop is enabled.

◆ swap_left_right

bool tmc51x0::ReferenceSwitchConfig::swap_left_right {false}

Swap left and right switch inputs (useful for reversed wiring)


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