|
HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
|
Reference switches / endstops subsystem (SW_MODE / XLATCH) More...
#include <tmc51x0.hpp>
Public Member Functions | |
| Switches (TMC51x0 &driver) noexcept | |
| Result< void > | ConfigureReferenceSwitch (const ReferenceSwitchConfig &config) noexcept |
| Configure reference switches / endstops (SW_MODE) | |
| Result< ReferenceSwitchConfig > | GetReferenceSwitchConfig () noexcept |
| Read reference switch configuration (SW_MODE) | |
| Result< void > | SetLeftSwitchActiveLevel (ReferenceSwitchActiveLevel active_level) noexcept |
| Set left reference switch active level / polarity. | |
| Result< void > | SetRightSwitchActiveLevel (ReferenceSwitchActiveLevel active_level) noexcept |
| Set right reference switch active level / polarity. | |
| Result< void > | SetLeftSwitchStopEnable (bool enable) noexcept |
| Enable/disable stop-on-left-switch (SW_MODE.stop_l_enable) | |
| Result< void > | SetRightSwitchStopEnable (bool enable) noexcept |
| Enable/disable stop-on-right-switch (SW_MODE.stop_r_enable) | |
| Result< void > | SetLeftSwitchLatchMode (ReferenceLatchMode latch_mode) noexcept |
| Configure left switch latching behavior (SW_MODE.latch_l_active) | |
| Result< void > | SetRightSwitchLatchMode (ReferenceLatchMode latch_mode) noexcept |
| Configure right switch latching behavior (SW_MODE.latch_r_active) | |
| Result< void > | SetStopMode (ReferenceStopMode stop_mode) noexcept |
| Set reference stop mode (hard/soft stop) for internal ramp generator. | |
| Result< bool > | GetReferenceSwitchStatus (bool &right_active, bool &left_enabled, bool &right_enabled) noexcept |
| Get reference switch active/enabled status (RAMP_STAT + SW_MODE) | |
| Result< float > | GetLatchedPosition (Unit unit) noexcept |
| Read latched position from XLATCH (unit-aware) | |
Private Attributes | |
| TMC51x0 & | driver_ |
Reference switches / endstops subsystem (SW_MODE / XLATCH)
Owns reference switch configuration, latching, and related status helpers. (This used to live under RampControl; it is separated to keep RampControl focused on motion profile programming.)
|
inlineexplicitnoexcept |
|
noexcept |
Configure reference switches / endstops (SW_MODE)
| config | Reference switch configuration |
Programs the reference switch logic in the SW_MODE register, including:
Use GetReferenceSwitchStatus() to read the current active state and whether stop-on-switch is enabled.
|
noexcept |
Read latched position from XLATCH (unit-aware)
| unit | Unit to return the position in |
XLATCH latches the internal position counter (microsteps). This helper converts it into the requested user unit based on the current microstep resolution and mechanical system configuration.
|
noexcept |
Read reference switch configuration (SW_MODE)
|
noexcept |
Get reference switch active/enabled status (RAMP_STAT + SW_MODE)
| right_active | Output: true if right switch is currently active |
| left_enabled | Output: true if left stop-on-switch is enabled |
| right_enabled | Output: true if right stop-on-switch is enabled |
|
noexcept |
Set left reference switch active level / polarity.
| active_level | Active level (ACTIVE_LOW / ACTIVE_HIGH) |
Convenience helper that reads the current SW_MODE, updates the left polarity field, and writes it back.
|
noexcept |
Configure left switch latching behavior (SW_MODE.latch_l_active)
| latch_mode | Latch mode selection |
|
noexcept |
Enable/disable stop-on-left-switch (SW_MODE.stop_l_enable)
| enable | True to enable stop-on-switch |
|
noexcept |
Set right reference switch active level / polarity.
| active_level | Active level (ACTIVE_LOW / ACTIVE_HIGH) |
Convenience helper that reads the current SW_MODE, updates the right polarity field, and writes it back.
|
noexcept |
Configure right switch latching behavior (SW_MODE.latch_r_active)
| latch_mode | Latch mode selection |
|
noexcept |
Enable/disable stop-on-right-switch (SW_MODE.stop_r_enable)
| enable | True to enable stop-on-switch |
|
noexcept |
Set reference stop mode (hard/soft stop) for internal ramp generator.
| stop_mode | Stop mode selection |
|
private |