|
HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
|
Encoder configuration structure. More...
#include <tmc51x0_types.hpp>
Public Member Functions | |
| EncoderConfig ()=default | |
| Default constructor. | |
Public Attributes | |
| ReferenceSwitchActiveLevel | n_channel_active |
| bool | require_a_high {false} |
| bool | require_b_high {false} |
| bool | ignore_ab_polarity {true} |
| EncoderNSensitivity | n_sensitivity |
| N channel event sensitivity (edge/level detection) | |
| EncoderClearMode | clear_mode {EncoderClearMode::DISABLED} |
| Clear mode for encoder counter on N events. | |
| bool | clear_enc_x_on_event {false} |
| bool | latch_xactual_with_enc {false} |
| EncoderPrescalerMode | prescaler_mode |
| Encoder prescaler divisor mode (enc_sel_decimal) | |
| int32_t | allowed_deviation_steps |
| Allowed encoder deviation in steps. | |
| uint16_t | pulses_per_rev {0} |
| Encoder pulses per revolution. | |
| bool | invert_direction {false} |
| Invert encoder direction. | |
Encoder configuration structure.
Configuration parameters for encoder interface operation. Uses enum-based API for intuitive configuration similar to ReferenceSwitchConfig.
|
default |
Default constructor.
Initializes with safe defaults:
| int32_t tmc51x0::EncoderConfig::allowed_deviation_steps |
Allowed encoder deviation in steps.
Maximum number of steps deviation between motor position (XACTUAL) and encoder position (X_ENC) before a deviation warning is triggered.
The deviation is automatically converted to microsteps using the current microstep setting. The register value is calculated as: deviation_microsteps = allowed_deviation_steps × current_microsteps
Range: 0 to 1048575 steps (0 = deviation detection disabled)
| bool tmc51x0::EncoderConfig::clear_enc_x_on_event {false} |
Clear encoder counter X_ENC upon N-event (clr_enc_x) true = latch and clear, false = latch only
| EncoderClearMode tmc51x0::EncoderConfig::clear_mode {EncoderClearMode::DISABLED} |
Clear mode for encoder counter on N events.
| bool tmc51x0::EncoderConfig::ignore_ab_polarity {true} |
Ignore A and B polarity for N channel event (ignore_AB) true = ignore A/B, false = validate A/B polarity
| bool tmc51x0::EncoderConfig::invert_direction {false} |
Invert encoder direction.
Whether the encoder direction should be inverted relative to motor direction. When true, the encoder counts in the opposite direction from the motor.
Default: false (encoder direction matches motor direction)
| bool tmc51x0::EncoderConfig::latch_xactual_with_enc {false} |
Also latch XACTUAL position together with X_ENC (latch_x_act) true = latch both, false = latch X_ENC only
| ReferenceSwitchActiveLevel tmc51x0::EncoderConfig::n_channel_active |
N channel active level (determines pol_N) ACTIVE_LOW = low active (pol_N=0), ACTIVE_HIGH = high active (pol_N=1)
| EncoderNSensitivity tmc51x0::EncoderConfig::n_sensitivity |
N channel event sensitivity (edge/level detection)
| EncoderPrescalerMode tmc51x0::EncoderConfig::prescaler_mode |
Encoder prescaler divisor mode (enc_sel_decimal)
| uint16_t tmc51x0::EncoderConfig::pulses_per_rev {0} |
Encoder pulses per revolution.
Number of encoder pulses per revolution (PPR). Used to calculate encoder resolution and set up the ENC_CONST register for position tracking.
Range: 0 to 65535 (0 = encoder resolution not configured)
| bool tmc51x0::EncoderConfig::require_a_high {false} |
Require A channel HIGH for N event validation (pol_A) true = A must be HIGH, false = A must be LOW
| bool tmc51x0::EncoderConfig::require_b_high {false} |
Require B channel HIGH for N event validation (pol_B) true = B must be HIGH, false = B must be LOW