HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
tmc51x0_types.hpp File Reference

Type definitions and enumerations for TMC51x0 stepper motor driver (TMC5130 & TMC5160) More...

#include <cstdint>
#include "registers/tmc51x0_registers.hpp"
Include dependency graph for tmc51x0_types.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tmc51x0::InputStatus
 Input pin status structure. More...
 
struct  tmc51x0::MechanicalSystem
 Mechanical system configuration structure. More...
 
struct  tmc51x0::MotorSpec
 Motor specification structure. More...
 
struct  tmc51x0::PowerStageParameters
 Power stage parameters structure. More...
 
struct  tmc51x0::MicrostepChangeOptions
 Options for changing microstep resolution (CHOPCONF.MRES) More...
 
struct  tmc51x0::ChopperConfig
 Chopper configuration structure. More...
 
struct  tmc51x0::StealthChopConfig
 StealthChop configuration structure. More...
 
struct  tmc51x0::StallGuardConfig
 StallGuard2 configuration structure. More...
 
struct  tmc51x0::StallGuardTuningResult
 Result structure for StallGuard2 threshold (SGT) tuning. More...
 
struct  tmc51x0::VelocityValue
 Self-describing velocity value with explicit unit. More...
 
struct  tmc51x0::AccelerationValue
 Self-describing acceleration value with explicit unit. More...
 
struct  tmc51x0::RampConfig
 Ramp configuration structure. More...
 
struct  tmc51x0::CoolStepConfig
 CoolStep configuration structure. More...
 
struct  tmc51x0::DcStepConfig
 DcStep configuration structure. More...
 
struct  tmc51x0::ReferenceSwitchConfig
 Reference switch configuration structure. More...
 
struct  tmc51x0::EncoderConfig
 Encoder configuration structure. More...
 
struct  tmc51x0::Diag0Config
 DIAG0 pin configuration structure. More...
 
struct  tmc51x0::Diag1Config
 DIAG1 pin configuration structure. More...
 
struct  tmc51x0::ExternalClockConfig
 External clock configuration structure. More...
 
struct  tmc51x0::UartConfig
 UART communication configuration structure. More...
 
struct  tmc51x0::GlobalConfig
 Global configuration (GCONF) structure. More...
 
struct  tmc51x0::DriverConfig
 Driver initialization configuration structure. More...
 
struct  tmc51x0::HomingSettingsCache
 Cached settings for homing operations. More...
 

Namespaces

namespace  tmc51x0
 
namespace  tmc51x0::ClockFreq
 TMC51x0 clock frequency constants.
 
namespace  tmc51x0::ChipVersion
 TMC chip version constants.
 
namespace  tmc51x0::RegisterConstants
 Register conversion constants.
 
namespace  tmc51x0::MathConstants
 Mathematical constants.
 

Enumerations

enum class  tmc51x0::ChipCommMode : uint8_t { tmc51x0::SPI_INTERNAL_RAMP , tmc51x0::SPI_EXTERNAL_STEPDIR = 1 , tmc51x0::UART_INTERNAL_RAMP , tmc51x0::STANDALONE_EXTERNAL_STEPDIR }
 Chip communication and motion control mode configuration. More...
 
enum class  tmc51x0::MotorDirection : uint8_t { tmc51x0::NORMAL = 0 , tmc51x0::INVERSE = 1 }
 Motor direction enumeration. More...
 
enum class  tmc51x0::MotorType : uint8_t {
  tmc51x0::STEPPER = 0 , tmc51x0::DC_MOTOR_SINGLE = 1 , tmc51x0::DC_MOTOR_DUAL = 2 , tmc51x0::SOLENOID_SINGLE = 3 ,
  tmc51x0::SOLENOID_DUAL = 4
}
 Motor type enumeration. More...
 
enum class  tmc51x0::Unit : uint8_t {
  tmc51x0::Steps , tmc51x0::Rad , tmc51x0::Deg , tmc51x0::Mm ,
  tmc51x0::RPM , tmc51x0::RevPerSec
}
 Unit enumeration. More...
 
enum class  tmc51x0::DriverStatus : uint8_t {
  tmc51x0::OK , tmc51x0::CP_UV , tmc51x0::S2VSA , tmc51x0::S2VSB ,
  tmc51x0::S2GA , tmc51x0::S2GB , tmc51x0::OT , tmc51x0::OTHER_ERR ,
  tmc51x0::OTPW
}
 Driver status enumeration. More...
 
enum class  tmc51x0::MechanicalSystemType : uint8_t { tmc51x0::DirectDrive , tmc51x0::LeadScrew , tmc51x0::BeltDrive , tmc51x0::Gearbox }
 Mechanical system type enumeration. More...
 
enum class  tmc51x0::SenseFilterTime : uint8_t { tmc51x0::T100ns = 0 , tmc51x0::T200ns = 1 , tmc51x0::T300ns = 2 , tmc51x0::T400ns = 3 }
 Sense amplifier filter time constant enumeration. More...
 
enum class  tmc51x0::OverTempProtection : uint8_t { tmc51x0::Temp150C = 0 , tmc51x0::Temp143C = 1 , tmc51x0::Temp136C = 2 , tmc51x0::Temp120C = 3 }
 Over-temperature protection level enumeration. More...
 
enum class  tmc51x0::ChopperMode : bool { tmc51x0::SPREAD_CYCLE = false , tmc51x0::CLASSIC = true }
 Chopper mode enumeration. More...
 
enum class  tmc51x0::ChopperBlankTime : uint8_t { tmc51x0::TBL_16CLK = 0 , tmc51x0::TBL_24CLK = 1 , tmc51x0::TBL_36CLK = 2 , tmc51x0::TBL_54CLK = 3 }
 Comparator blank time enumeration. More...
 
enum class  tmc51x0::MicrostepResolution : uint8_t {
  tmc51x0::MRES_256 = 0 , tmc51x0::MRES_128 = 1 , tmc51x0::MRES_64 = 2 , tmc51x0::MRES_32 = 3 ,
  tmc51x0::MRES_16 = 4 , tmc51x0::MRES_8 = 5 , tmc51x0::MRES_4 = 6 , tmc51x0::MRES_2 = 7 ,
  tmc51x0::FULLSTEP = 8
}
 Microstep resolution enumeration. More...
 
enum class  tmc51x0::MicrostepLutPreset : uint8_t { tmc51x0::DEFAULT_SINE = 0 , tmc51x0::PURE_SINE = 1 }
 Microstep lookup table preset waveforms. More...
 
enum class  tmc51x0::StealthChopPwmFreq : uint8_t { tmc51x0::PWM_FREQ_0 = 0 , tmc51x0::PWM_FREQ_1 = 1 , tmc51x0::PWM_FREQ_2 = 2 , tmc51x0::PWM_FREQ_3 = 3 }
 StealthChop PWM frequency enumeration. More...
 
enum class  tmc51x0::StealthChopRegulationSpeed : uint8_t {
  tmc51x0::VERY_SLOW = 1 , tmc51x0::SLOW = 2 , tmc51x0::MODERATE = 4 , tmc51x0::FAST = 8 ,
  tmc51x0::VERY_FAST = 15
}
 StealthChop regulation speed enumeration. More...
 
enum class  tmc51x0::StealthChopJerkReduction : uint8_t {
  tmc51x0::MAXIMUM = 8 , tmc51x0::HIGH = 10 , tmc51x0::MODERATE = 12 , tmc51x0::LOW = 14 ,
  tmc51x0::MINIMUM = 15
}
 StealthChop mode switching jerk reduction enumeration. More...
 
enum class  tmc51x0::StallGuardSensitivity : int8_t {
  tmc51x0::VERY_HIGH = -32 , tmc51x0::HIGH = -16 , tmc51x0::MODERATE = 0 , tmc51x0::LOW = 16 ,
  tmc51x0::VERY_LOW = 32
}
 StallGuard2 sensitivity enumeration. More...
 
enum class  tmc51x0::CoolStepIncrementStep : uint8_t { tmc51x0::STEP_1 = 0 , tmc51x0::STEP_2 = 1 , tmc51x0::STEP_4 = 2 , tmc51x0::STEP_8 = 3 }
 CoolStep current increment step width enumeration. More...
 
enum class  tmc51x0::CoolStepDecrementSpeed : uint8_t { tmc51x0::EVERY_32 = 0 , tmc51x0::EVERY_8 = 1 , tmc51x0::EVERY_2 = 2 , tmc51x0::EVERY_1 = 3 }
 CoolStep current decrement speed enumeration. More...
 
enum class  tmc51x0::CoolStepMinCurrent : uint8_t { tmc51x0::HALF_IRUN = 0 , tmc51x0::QUARTER_IRUN = 1 }
 CoolStep minimum current percentage enumeration. More...
 
enum class  tmc51x0::DcStepStallSensitivity : uint8_t { tmc51x0::DISABLED = 0 , tmc51x0::LOW = 1 , tmc51x0::MODERATE = 2 , tmc51x0::HIGH = 3 }
 DcStep stall detection sensitivity enumeration. More...
 
enum class  tmc51x0::ReferenceSwitchActiveLevel : uint8_t { tmc51x0::ACTIVE_LOW , tmc51x0::ACTIVE_HIGH }
 Reference switch active level enumeration. More...
 
enum class  tmc51x0::ReferenceLatchMode : uint8_t { tmc51x0::DISABLED , tmc51x0::ACTIVE_EDGE , tmc51x0::INACTIVE_EDGE , tmc51x0::BOTH_EDGES }
 Position latching mode enumeration. More...
 
enum class  tmc51x0::ReferenceStopMode : uint8_t { tmc51x0::HARD_STOP , tmc51x0::SOFT_STOP }
 Stop mode enumeration. More...
 
enum class  tmc51x0::EncoderNSensitivity : uint8_t { tmc51x0::ACTIVE_LEVEL , tmc51x0::RISING_EDGE , tmc51x0::FALLING_EDGE , tmc51x0::BOTH_EDGES }
 Encoder N channel sensitivity enumeration. More...
 
enum class  tmc51x0::EncoderClearMode : uint8_t { tmc51x0::DISABLED , tmc51x0::ONCE , tmc51x0::CONTINUOUS }
 Encoder clear mode enumeration. More...
 
enum class  tmc51x0::EncoderPrescalerMode : uint8_t { tmc51x0::BINARY , tmc51x0::DECIMAL }
 Encoder prescaler mode enumeration. More...
 

Functions

constexpr const char * tmc51x0::ToString (MotorDirection d) noexcept
 Convert MotorDirection to human-readable string.
 
constexpr const char * tmc51x0::ToString (MotorType t) noexcept
 Convert MotorType to human-readable string.
 
constexpr const char * tmc51x0::ToString (Unit u) noexcept
 Convert Unit to human-readable string.
 
constexpr const char * tmc51x0::ToString (MechanicalSystemType type) noexcept
 Convert MechanicalSystemType to human-readable string.
 
constexpr const char * tmc51x0::ToString (ChopperMode m) noexcept
 Convert ChopperMode to human-readable string.
 
constexpr const char * tmc51x0::ToString (MicrostepResolution mres) noexcept
 Convert MicrostepResolution to human-readable string.
 
constexpr uint16_t tmc51x0::MicrostepsPerFullStep (MicrostepResolution mres) noexcept
 Get microsteps-per-full-step for an MRES value.
 
constexpr const char * tmc51x0::ToString (MicrostepLutPreset preset) noexcept
 Convert MicrostepLutPreset to human-readable string.
 
constexpr const char * tmc51x0::ToString (ReferenceSwitchActiveLevel a) noexcept
 Convert ReferenceSwitchActiveLevel to human-readable string.
 
constexpr const char * tmc51x0::ToString (ReferenceLatchMode m) noexcept
 Convert ReferenceLatchMode to human-readable string.
 
constexpr const char * tmc51x0::ToString (ReferenceStopMode m) noexcept
 Convert ReferenceStopMode to human-readable string.
 
constexpr const char * tmc51x0::ToString (EncoderNSensitivity s) noexcept
 Convert EncoderNSensitivity to human-readable string.
 
constexpr const char * tmc51x0::ToString (EncoderClearMode m) noexcept
 Convert EncoderClearMode to human-readable string.
 
constexpr const char * tmc51x0::ToString (EncoderPrescalerMode m) noexcept
 Convert EncoderPrescalerMode to human-readable string.
 

Variables

constexpr uint32_t tmc51x0::ClockFreq::DEFAULT_F_CLK = 12000000U
 Typical internal clock frequency in Hz (12 MHz)
 
constexpr uint32_t tmc51x0::ClockFreq::MIN_F_CLK = 8000000U
 Minimum clock frequency in Hz.
 
constexpr uint32_t tmc51x0::ClockFreq::MAX_F_CLK = 16000000U
 Maximum clock frequency in Hz.
 
constexpr uint8_t tmc51x0::ChipVersion::TMC5130 = 0x11
 TMC5130 chip version.
 
constexpr uint8_t tmc51x0::ChipVersion::TMC5160 = 0x30
 TMC5160 chip version.
 
constexpr float tmc51x0::RegisterConstants::TPOWERDOWN_DIVISOR = 262144.0F
 2^18, used for TPOWERDOWN and TZEROWAIT register conversion
 
constexpr float tmc51x0::RegisterConstants::MS_PER_SEC = 1e3F
 Milliseconds per second (used for ms to seconds conversion)
 
constexpr float tmc51x0::RegisterConstants::US_PER_SEC = 1e6F
 Microseconds per second (used for us to seconds conversion)
 
constexpr float tmc51x0::RegisterConstants::NS_PER_SEC = 1e9F
 Nanoseconds per second (used for ns to seconds conversion)
 
constexpr float tmc51x0::RegisterConstants::ENC_DECIMAL_MULTIPLIER = 1e4F
 Multiplier for encoder decimal mode (fractional part)
 
constexpr uint32_t tmc51x0::RegisterConstants::ENC_BINARY_MULTIPLIER = 65536U
 Multiplier for encoder binary mode (2^16)
 
constexpr float tmc51x0::MathConstants::PI = 3.14159265359F
 π (pi) constant
 
constexpr float tmc51x0::MathConstants::TWO_PI = 2.0F * PI
 2π (two pi)
 
constexpr float tmc51x0::MathConstants::DEGREES_PER_REV = 360.0F
 Degrees per revolution.
 

Detailed Description

Type definitions and enumerations for TMC51x0 stepper motor driver (TMC5130 & TMC5160)