ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
esphome::tmc22xx::TMC22XXStepper Class Referenceabstract

Base class for Trinamic stepper drivers that are configured over the single wire UART interface. More...

#include <tmc22xx.h>

Inheritance diagram for esphome::tmc22xx::TMC22XXStepper:
esphome::stepper::Stepper esphome::Component esphome::uart::UARTDevice esphome::tmc2209::TMC2209Stepper

Public Member Functions

void setup () override
 
void loop () override
 
void dump_config () override
 
void on_shutdown () override
 
float get_setup_priority () const override
 
void set_address (uint8_t address)
 
void set_enn_pin (GPIOPin *pin)
 
void set_step_pin (GPIOPin *pin)
 
void set_dir_pin (GPIOPin *pin)
 
void set_index_pin (InternalGPIOPin *pin)
 
void set_diag_pin (InternalGPIOPin *pin)
 
void set_clock_frequency (uint32_t frequency)
 
void set_rsense (float rsense)
 
void set_vsense (bool vsense)
 
void set_ottrim (uint8_t ottrim)
 
void set_analog_current_scale (bool enable)
 
void set_initial_run_current (float current)
 
void set_initial_hold_current (float current)
 
void set_initial_microsteps (uint16_t microsteps)
 
void set_enabled (bool enabled)
 Enable or disable the motor outputs, using the ENN pin when configured and TOFF otherwise.
 
bool is_enabled () const
 
bool is_unreachable () const
 True while the driver does not answer, until the status poll reads it again (every 10 s).
 
template<typename F >
void add_on_status_callback (F &&callback)
 Called with the condition and whether it became active or cleared.
 
void set_microsteps (uint16_t microsteps)
 
uint16_t get_microsteps ()
 
void set_interpolation (bool enable)
 
void set_spreadcycle (bool enable)
 
void set_inverse_direction (bool inverse)
 
void set_tpwm_threshold (uint32_t threshold)
 
void set_run_current (float current)
 Set the motor run or hold current in A RMS.
 
void set_hold_current (float current)
 
void set_irun (uint8_t irun)
 
void set_ihold (uint8_t ihold)
 
void set_iholddelay (uint8_t delay)
 
void set_tpowerdown (uint8_t tpowerdown)
 
void set_standstill_mode (StandstillMode mode)
 
void set_toff (uint8_t toff)
 Chopper off time (1-15). TOFF=0 is used to disable the outputs, so this is applied on the next enable.
 
void set_tbl (uint8_t tbl)
 
void set_hend (uint8_t hend)
 
void set_hstrt (uint8_t hstrt)
 
void set_pwm_ofs (uint8_t ofs)
 
void set_pwm_grad (uint8_t grad)
 
void set_pwm_freq (uint8_t freq)
 
void set_pwm_autoscale (bool enable)
 
void set_pwm_autograd (bool enable)
 
void set_pwm_reg (uint8_t reg)
 
void set_pwm_lim (uint8_t lim)
 
float scale_to_current (uint8_t scale)
 Convert a current scale (0-31) to A RMS, without analog current scale.
 
bool write_register (uint8_t reg, uint32_t value)
 
optional< uint32_t > read_register (uint8_t reg)
 
bool write_field (const RegisterField &field, uint32_t value)
 
optional< uint32_t > read_field (const RegisterField &field)
 
- Public Member Functions inherited from esphome::stepper::Stepper
void set_target (int32_t steps)
 
void report_position (int32_t steps)
 
void set_acceleration (float acceleration)
 
void set_deceleration (float deceleration)
 
void set_max_speed (float max_speed)
 
virtual void on_update_speed ()
 
bool has_reached_target ()
 
- Public Member Functions inherited from esphome::Component
float get_actual_setup_priority () const
 
void set_setup_priority (float priority)
 
void call ()
 
virtual void on_safe_shutdown ()
 
virtual bool teardown ()
 Called during teardown to allow component to gracefully finish operations.
 
virtual void on_powerdown ()
 Called last before a reboot or deep sleep to power down hardware.
 
uint8_t get_component_state () const
 
void reset_to_construction_state ()
 Reset this component back to the construction state to allow setup to run again.
 
bool is_in_loop_state () const
 Check if this component has completed setup and is in the loop state.
 
bool is_idle () const
 Check if this component is idle.
 
void mark_failed ()
 Mark this component as failed.
 
void mark_failed (const LogString *message)
 
bool ESPHOME_ALWAYS_INLINE setup_check (bool ok)
 Marks the component failed with message (default "Communication failed") unless ok; returns ok.
 
bool ESPHOME_ALWAYS_INLINE setup_check (bool ok, const LogString *message)
 
void disable_loop ()
 Disable this component's loop.
 
void enable_loop ()
 Enable this component's loop.
 
void enable_loop_soon_any_context ()
 Thread and ISR-safe version of enable_loop() that can be called from any context.
 
bool is_failed () const
 
bool is_ready () const
 
virtual bool can_proceed ()
 
bool status_has_warning () const
 
bool status_has_error () const
 
void status_set_warning ()
 
void status_set_warning (const char *message)
 
void status_set_warning (const LogString *message)
 
bool status_comm_result (bool ok)
 Clears the warning when ok, else sets it with message (default "Communication failed"); returns ok.
 
bool status_comm_result (bool ok, const LogString *message)
 
void status_set_error ()
 
void status_set_error (const LogString *message)
 
void status_clear_warning ()
 
void status_clear_error ()
 
 ESPDEPRECATED ("Use status_momentary_warning() without a name. Removed in 2027.5.0", "2026.11.0") void status_momentary_warning(const char *name
 
void status_momentary_warning (uint32_t length=5000)
 Set warning status flag and clear it after length ms.
 
void status_momentary_warning (const LogString *message, uint32_t length=5000)
 
 ESPDEPRECATED ("Use status_momentary_error() without a name. Removed in 2027.5.0", "2026.11.0") void status_momentary_error(const char *name
 
void status_momentary_error (uint32_t length=5000)
 Set error status flag and clear it after length ms.
 
void status_momentary_error (const LogString *message, uint32_t length=5000)
 
bool has_overridden_loop () const
 
const LogString * get_component_log_str () const ESPHOME_ALWAYS_INLINE
 Get the integration where this component was declared as a LogString for logging.
 
bool should_warn_of_blocking (uint32_t blocking_time, uint32_t &threshold_ms_out)
 
- Public Member Functions inherited from esphome::uart::UARTDevice
 UARTDevice ()=default
 
 UARTDevice (UARTComponent *parent)
 
void set_uart_parent (UARTComponent *parent)
 
void write_byte (uint8_t data)
 
void set_rx_full_threshold (size_t rx_full_threshold)
 
void set_rx_full_threshold_ms (size_t time)
 
size_t get_rx_full_threshold ()
 
void set_rx_timeout (size_t rx_timeout)
 
size_t get_rx_timeout ()
 
void write_array (const uint8_t *data, size_t len)
 
void write_array_progmem (const uint8_t *data, size_t len)
 
void write_array (const std::vector< uint8_t > &data)
 
template<size_t N>
void write_array (const std::array< uint8_t, N > &data)
 
void write_str (const char *str)
 
bool read_byte (uint8_t *data)
 
bool peek_byte (uint8_t *data)
 
bool read_array (uint8_t *data, size_t len)
 
template<size_t N>
optional< std::array< uint8_t, N > > read_array ()
 
size_t available ()
 
template<size_t N = 64, typename F >
bool read_available_chunks (F &&on_chunk)
 Pass the bytes available now to on_chunk(data, len) in N byte chunks; returning false stops.
 
template<size_t N = 64, typename F >
bool read_available_chunks (F &&on_chunk, size_t count)
 Same, reading exactly count bytes; count must not exceed available().
 
template<size_t N = 64, typename F >
bool read_available (F &&on_byte)
 Same as read_available_chunks(), calling on_byte(uint8_t) once per byte.
 
template<size_t N = 64, typename F >
bool read_available (F &&on_byte, size_t count)
 
void discard_available ()
 Read and drop every byte waiting in the receive buffer.
 
UARTFlushResult flush ()
 
int read ()
 
size_t write (uint8_t data)
 
int peek ()
 
 ESPDEPRECATED ("Use uart.final_validate_device_schema() in Python instead. Removed in 2027.3.0", "2026.9.0") void check_uart_settings(uint32_t baud_rate
 Check that the configuration of the UART bus matches the provided values and otherwise print a warning.
 

Static Public Member Functions

static uint32_t extract_field (uint32_t data, const RegisterField &field)
 

Protected Member Functions

virtual uint8_t expected_version () const =0
 IC version reported in IOIN by the supported chip.
 
virtual uint32_t * shadow_register (uint8_t reg)
 Return the cached value of a write-only register, or nullptr when the register is readable.
 
virtual void restore_registers ()
 Write the cached write-only registers and the last written configuration registers to the driver, at setup and after a driver reset.
 
void apply_config_ ()
 Write the settings from the configuration to the readable registers.
 
virtual void on_diag_without_error ()
 Called when DIAG rises without a driver error.
 
bool update_status_ ()
 Read GSTAT and DRV_STATUS and report changes. Returns false when the status could not be read.
 
optional< uint8_t > current_to_scale_ (float current)
 
float full_scale_current_ ()
 
int32_t get_vactual_ () const
 
int32_t speed_to_vactual_ (float speed) const
 
void add_index_pulses_ ()
 
void loop_serial_ ()
 
void loop_step_dir_ ()
 
- Protected Member Functions inherited from esphome::stepper::Stepper
void calculate_speed_ (uint32_t now)
 
int32_t should_step_ ()
 
- Protected Member Functions inherited from esphome::Component
friend void::setup ()
 
friend void::original_setup ()
 
void set_component_source_ (uint8_t index)
 Set where this component was loaded from for some debug messages.
 
virtual void call_setup ()
 
void call_dump_config_ ()
 
void enable_loop_slow_path_ ()
 
void set_component_state_ (uint8_t state)
 Helper to set component state (clears state bits and sets new state)
 
bool set_status_flag_ (uint8_t flag)
 Helper to set a status LED flag on both this component and the app.
 
bool set_error_flag_ (const LogString *message)
 Set the error flag and log it; true when it was not set before.
 
void set_interval (const char *name, uint32_t interval, std::function< void()> &&f)
 Set an interval function with a const char* name.
 
void set_interval (uint32_t id, uint32_t interval, std::function< void()> &&f)
 Set an interval function with a numeric ID (zero heap allocation).
 
void set_interval (InternalSchedulerID id, uint32_t interval, std::function< void()> &&f)
 
void set_interval (uint32_t interval, std::function< void()> &&f)
 
bool cancel_interval (const char *name)
 Cancel an interval function.
 
bool cancel_interval (uint32_t id)
 
bool cancel_interval (InternalSchedulerID id)
 
void set_timeout (const char *name, uint32_t timeout, std::function< void()> &&f)
 Set a timeout function with a const char* name.
 
void set_timeout (uint32_t id, uint32_t timeout, std::function< void()> &&f)
 Set a timeout function with a numeric ID (zero heap allocation).
 
void set_timeout (InternalSchedulerID id, uint32_t timeout, std::function< void()> &&f)
 
void set_timeout (uint32_t timeout, std::function< void()> &&f)
 
bool cancel_timeout (const char *name)
 Cancel a timeout function.
 
bool cancel_timeout (uint32_t id)
 
bool cancel_timeout (InternalSchedulerID id)
 
void defer (const char *name, std::function< void()> &&f)
 Defer a callback to the next loop() call with a const char* name.
 
void defer (std::function< void()> &&f)
 Defer a callback to the next loop() call.
 
void defer (uint32_t id, std::function< void()> &&f)
 Defer a callback with a numeric ID (zero heap allocation)
 
bool cancel_defer (const char *name)
 Cancel a defer callback using the specified name, name must not be empty.
 
bool cancel_defer (uint32_t id)
 
void status_clear_warning_slow_path_ ()
 
void status_clear_error_slow_path_ ()
 

Protected Attributes

GPIOPin * enn_pin_ {nullptr}
 
GPIOPin * step_pin_ {nullptr}
 
GPIOPin * dir_pin_ {nullptr}
 
InternalGPIOPin * index_pin_ {nullptr}
 
InternalGPIOPin * diag_pin_ {nullptr}
 
LazyCallbackManager< void(DriverEvent, bool)> status_callback_
 
uint32_t clock_frequency_ {12000000}
 
uint32_t ihold_irun_ {0x00071703}
 
uint32_t tpowerdown_ {0x14}
 
uint32_t tpwmthrs_ {0}
 
uint32_t vactual_reg_ {0}
 
std::array< uint32_t, RESTORED_REGISTERS.size()> restored_values_ {}
 
float rsense_ {NAN}
 
float initial_run_current_ {NAN}
 
float initial_hold_current_ {NAN}
 
IndexPulseStore index_store_ {}
 
uint16_t initial_microsteps_ {16}
 
uint16_t status_ {0}
 
optional< bool > vsense_ {}
 
optional< uint8_t > ottrim_ {}
 
uint8_t address_ {0}
 
uint8_t toff_ {3}
 
uint8_t version_ {0}
 
uint8_t restored_written_ {0}
 
uint8_t status_poll_skip_ {0}
 
int8_t direction_ {0}
 
DiagPinStore diag_store_ {}
 
bool analog_current_scale_ {false}
 
bool enabled_ {false}
 
bool vsense_active_ {false}
 
bool step_state_ {false}
 
bool moving_ {false}
 
HighFrequencyLoopRequester high_freq_
 
- Protected Attributes inherited from esphome::stepper::Stepper
float acceleration_ {1e6f}
 
float deceleration_ {1e6f}
 
float current_speed_ {0.0f}
 
float max_speed_ {1e6f}
 
uint32_t last_calculation_ {0}
 
uint32_t last_step_ {0}
 
- Protected Attributes inherited from esphome::Component
uint8_t component_source_index_ {0}
 Index into component source PROGMEM lookup table (0 = not set)
 
uint8_t warn_if_blocking_over_ {WARN_IF_BLOCKING_OVER_CS}
 Warn threshold in centiseconds (max 2550ms)
 
uint8_t component_state_ {0x00}
 State of this component - each bit has a purpose: Bits 0-2: Component state (0x00=CONSTRUCTION, 0x01=SETUP, 0x02=LOOP, 0x03=FAILED, 0x04=LOOP_DONE) Bit 3: STATUS_LED_WARNING Bit 4: STATUS_LED_ERROR Bit 5: Has overridden loop() (set at registration time) Bits 6-7: Unused - reserved for future expansion.
 
volatile bool pending_enable_loop_ {false}
 ISR-safe flag for enable_loop_soon_any_context.
 
ComponentRuntimeStats runtime_stats_
 
- Protected Attributes inherited from esphome::uart::UARTDevice
UARTComponent * parent_ {nullptr}
 

Additional Inherited Members

- Data Fields inherited from esphome::stepper::Stepper
int32_t current_position {0}
 
int32_t target_position {0}
 
- Data Fields inherited from esphome::Component
uint32_t length = 5000)
 
- Data Fields inherited from esphome::uart::UARTDevice
uint8_t stop_bits = 1
 
uint8_t UARTParityOptions parity = UART_CONFIG_PARITY_NONE
 
uint8_t UARTParityOptions uint8_t data_bits = 8)
 
- Static Protected Member Functions inherited from esphome::uart::UARTDevice
template<typename F , typename... A>
static bool continue_after (F &f, A... args)
 Call f(args...) and return its result; a void callback always continues.
 

Detailed Description

Base class for Trinamic stepper drivers that are configured over the single wire UART interface.

Definition at line 123 of file tmc22xx.h.

Member Function Documentation

◆ add_index_pulses_()

void esphome::tmc22xx::TMC22XXStepper::add_index_pulses_ ( )
protected

Definition at line 296 of file tmc22xx.cpp.

◆ add_on_status_callback()

template<typename F >
void esphome::tmc22xx::TMC22XXStepper::add_on_status_callback ( F && callback)
inline

Called with the condition and whether it became active or cleared.

Definition at line 153 of file tmc22xx.h.

◆ apply_config_()

void esphome::tmc22xx::TMC22XXStepper::apply_config_ ( )
protected

Write the settings from the configuration to the readable registers.

Definition at line 157 of file tmc22xx.cpp.

◆ current_to_scale_()

optional< uint8_t > esphome::tmc22xx::TMC22XXStepper::current_to_scale_ ( float current)
protected

Definition at line 405 of file tmc22xx.cpp.

◆ dump_config()

void esphome::tmc22xx::TMC22XXStepper::dump_config ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 229 of file tmc22xx.cpp.

◆ expected_version()

virtual uint8_t esphome::tmc22xx::TMC22XXStepper::expected_version ( ) const
protectedpure virtual

IC version reported in IOIN by the supported chip.

Implemented in esphome::tmc2209::TMC2209Stepper.

◆ extract_field()

uint32_t esphome::tmc22xx::TMC22XXStepper::extract_field ( uint32_t data,
const RegisterField & field )
static

Definition at line 518 of file tmc22xx.cpp.

◆ full_scale_current_()

float esphome::tmc22xx::TMC22XXStepper::full_scale_current_ ( )
protected

Definition at line 396 of file tmc22xx.cpp.

◆ get_microsteps()

uint16_t esphome::tmc22xx::TMC22XXStepper::get_microsteps ( )

Definition at line 379 of file tmc22xx.cpp.

◆ get_setup_priority()

float esphome::tmc22xx::TMC22XXStepper::get_setup_priority ( ) const
inlineoverridevirtual

Reimplemented from esphome::Component.

Definition at line 129 of file tmc22xx.h.

◆ get_vactual_()

int32_t esphome::tmc22xx::TMC22XXStepper::get_vactual_ ( ) const
inlineprotected

Definition at line 212 of file tmc22xx.h.

◆ is_enabled()

bool esphome::tmc22xx::TMC22XXStepper::is_enabled ( ) const
inline

Definition at line 148 of file tmc22xx.h.

◆ is_unreachable()

bool esphome::tmc22xx::TMC22XXStepper::is_unreachable ( ) const
inline

True while the driver does not answer, until the status poll reads it again (every 10 s).

Definition at line 150 of file tmc22xx.h.

◆ loop()

void esphome::tmc22xx::TMC22XXStepper::loop ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 261 of file tmc22xx.cpp.

◆ loop_serial_()

void esphome::tmc22xx::TMC22XXStepper::loop_serial_ ( )
protected

Definition at line 302 of file tmc22xx.cpp.

◆ loop_step_dir_()

void esphome::tmc22xx::TMC22XXStepper::loop_step_dir_ ( )
protected

Definition at line 323 of file tmc22xx.cpp.

◆ on_diag_without_error()

virtual void esphome::tmc22xx::TMC22XXStepper::on_diag_without_error ( )
inlineprotectedvirtual

Called when DIAG rises without a driver error.

Reimplemented in esphome::tmc2209::TMC2209Stepper.

Definition at line 207 of file tmc22xx.h.

◆ on_shutdown()

void esphome::tmc22xx::TMC22XXStepper::on_shutdown ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 336 of file tmc22xx.cpp.

◆ read_field()

optional< uint32_t > esphome::tmc22xx::TMC22XXStepper::read_field ( const RegisterField & field)

Definition at line 511 of file tmc22xx.cpp.

◆ read_register()

optional< uint32_t > esphome::tmc22xx::TMC22XXStepper::read_register ( uint8_t reg)

Definition at line 468 of file tmc22xx.cpp.

◆ restore_registers()

void esphome::tmc22xx::TMC22XXStepper::restore_registers ( )
protectedvirtual

Write the cached write-only registers and the last written configuration registers to the driver, at setup and after a driver reset.

Reimplemented in esphome::tmc2209::TMC2209Stepper.

Definition at line 146 of file tmc22xx.cpp.

◆ scale_to_current()

float esphome::tmc22xx::TMC22XXStepper::scale_to_current ( uint8_t scale)

Convert a current scale (0-31) to A RMS, without analog current scale.

Definition at line 401 of file tmc22xx.cpp.

◆ set_address()

void esphome::tmc22xx::TMC22XXStepper::set_address ( uint8_t address)
inline

Definition at line 131 of file tmc22xx.h.

◆ set_analog_current_scale()

void esphome::tmc22xx::TMC22XXStepper::set_analog_current_scale ( bool enable)
inline

Definition at line 141 of file tmc22xx.h.

◆ set_clock_frequency()

void esphome::tmc22xx::TMC22XXStepper::set_clock_frequency ( uint32_t frequency)
inline

Definition at line 137 of file tmc22xx.h.

◆ set_diag_pin()

void esphome::tmc22xx::TMC22XXStepper::set_diag_pin ( InternalGPIOPin * pin)
inline

Definition at line 136 of file tmc22xx.h.

◆ set_dir_pin()

void esphome::tmc22xx::TMC22XXStepper::set_dir_pin ( GPIOPin * pin)
inline

Definition at line 134 of file tmc22xx.h.

◆ set_enabled()

void esphome::tmc22xx::TMC22XXStepper::set_enabled ( bool enabled)

Enable or disable the motor outputs, using the ENN pin when configured and TOFF otherwise.

Definition at line 341 of file tmc22xx.cpp.

◆ set_enn_pin()

void esphome::tmc22xx::TMC22XXStepper::set_enn_pin ( GPIOPin * pin)
inline

Definition at line 132 of file tmc22xx.h.

◆ set_hend()

void esphome::tmc22xx::TMC22XXStepper::set_hend ( uint8_t hend)
inline

Definition at line 177 of file tmc22xx.h.

◆ set_hold_current()

void esphome::tmc22xx::TMC22XXStepper::set_hold_current ( float current)

Definition at line 391 of file tmc22xx.cpp.

◆ set_hstrt()

void esphome::tmc22xx::TMC22XXStepper::set_hstrt ( uint8_t hstrt)
inline

Definition at line 178 of file tmc22xx.h.

◆ set_ihold()

void esphome::tmc22xx::TMC22XXStepper::set_ihold ( uint8_t ihold)
inline

Definition at line 169 of file tmc22xx.h.

◆ set_iholddelay()

void esphome::tmc22xx::TMC22XXStepper::set_iholddelay ( uint8_t delay)
inline

Definition at line 170 of file tmc22xx.h.

◆ set_index_pin()

void esphome::tmc22xx::TMC22XXStepper::set_index_pin ( InternalGPIOPin * pin)
inline

Definition at line 135 of file tmc22xx.h.

◆ set_initial_hold_current()

void esphome::tmc22xx::TMC22XXStepper::set_initial_hold_current ( float current)
inline

Definition at line 143 of file tmc22xx.h.

◆ set_initial_microsteps()

void esphome::tmc22xx::TMC22XXStepper::set_initial_microsteps ( uint16_t microsteps)
inline

Definition at line 144 of file tmc22xx.h.

◆ set_initial_run_current()

void esphome::tmc22xx::TMC22XXStepper::set_initial_run_current ( float current)
inline

Definition at line 142 of file tmc22xx.h.

◆ set_interpolation()

void esphome::tmc22xx::TMC22XXStepper::set_interpolation ( bool enable)
inline

Definition at line 159 of file tmc22xx.h.

◆ set_inverse_direction()

void esphome::tmc22xx::TMC22XXStepper::set_inverse_direction ( bool inverse)
inline

Definition at line 161 of file tmc22xx.h.

◆ set_irun()

void esphome::tmc22xx::TMC22XXStepper::set_irun ( uint8_t irun)
inline

Definition at line 168 of file tmc22xx.h.

◆ set_microsteps()

void esphome::tmc22xx::TMC22XXStepper::set_microsteps ( uint16_t microsteps)

Definition at line 369 of file tmc22xx.cpp.

◆ set_ottrim()

void esphome::tmc22xx::TMC22XXStepper::set_ottrim ( uint8_t ottrim)
inline

Definition at line 140 of file tmc22xx.h.

◆ set_pwm_autograd()

void esphome::tmc22xx::TMC22XXStepper::set_pwm_autograd ( bool enable)
inline

Definition at line 184 of file tmc22xx.h.

◆ set_pwm_autoscale()

void esphome::tmc22xx::TMC22XXStepper::set_pwm_autoscale ( bool enable)
inline

Definition at line 183 of file tmc22xx.h.

◆ set_pwm_freq()

void esphome::tmc22xx::TMC22XXStepper::set_pwm_freq ( uint8_t freq)
inline

Definition at line 182 of file tmc22xx.h.

◆ set_pwm_grad()

void esphome::tmc22xx::TMC22XXStepper::set_pwm_grad ( uint8_t grad)
inline

Definition at line 181 of file tmc22xx.h.

◆ set_pwm_lim()

void esphome::tmc22xx::TMC22XXStepper::set_pwm_lim ( uint8_t lim)
inline

Definition at line 186 of file tmc22xx.h.

◆ set_pwm_ofs()

void esphome::tmc22xx::TMC22XXStepper::set_pwm_ofs ( uint8_t ofs)
inline

Definition at line 180 of file tmc22xx.h.

◆ set_pwm_reg()

void esphome::tmc22xx::TMC22XXStepper::set_pwm_reg ( uint8_t reg)
inline

Definition at line 185 of file tmc22xx.h.

◆ set_rsense()

void esphome::tmc22xx::TMC22XXStepper::set_rsense ( float rsense)
inline

Definition at line 138 of file tmc22xx.h.

◆ set_run_current()

void esphome::tmc22xx::TMC22XXStepper::set_run_current ( float current)

Set the motor run or hold current in A RMS.

Not supported with analog current scale, use set_irun() and set_ihold() instead.

Definition at line 386 of file tmc22xx.cpp.

◆ set_spreadcycle()

void esphome::tmc22xx::TMC22XXStepper::set_spreadcycle ( bool enable)
inline

Definition at line 160 of file tmc22xx.h.

◆ set_standstill_mode()

void esphome::tmc22xx::TMC22XXStepper::set_standstill_mode ( StandstillMode mode)
inline

Definition at line 172 of file tmc22xx.h.

◆ set_step_pin()

void esphome::tmc22xx::TMC22XXStepper::set_step_pin ( GPIOPin * pin)
inline

Definition at line 133 of file tmc22xx.h.

◆ set_tbl()

void esphome::tmc22xx::TMC22XXStepper::set_tbl ( uint8_t tbl)
inline

Definition at line 176 of file tmc22xx.h.

◆ set_toff()

void esphome::tmc22xx::TMC22XXStepper::set_toff ( uint8_t toff)

Chopper off time (1-15). TOFF=0 is used to disable the outputs, so this is applied on the next enable.

Definition at line 362 of file tmc22xx.cpp.

◆ set_tpowerdown()

void esphome::tmc22xx::TMC22XXStepper::set_tpowerdown ( uint8_t tpowerdown)
inline

Definition at line 171 of file tmc22xx.h.

◆ set_tpwm_threshold()

void esphome::tmc22xx::TMC22XXStepper::set_tpwm_threshold ( uint32_t threshold)
inline

Definition at line 162 of file tmc22xx.h.

◆ set_vsense()

void esphome::tmc22xx::TMC22XXStepper::set_vsense ( bool vsense)
inline

Definition at line 139 of file tmc22xx.h.

◆ setup()

void esphome::tmc22xx::TMC22XXStepper::setup ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 93 of file tmc22xx.cpp.

◆ shadow_register()

uint32_t * esphome::tmc22xx::TMC22XXStepper::shadow_register ( uint8_t reg)
protectedvirtual

Return the cached value of a write-only register, or nullptr when the register is readable.

Reimplemented in esphome::tmc2209::TMC2209Stepper.

Definition at line 423 of file tmc22xx.cpp.

◆ speed_to_vactual_()

int32_t esphome::tmc22xx::TMC22XXStepper::speed_to_vactual_ ( float speed) const
protected

Definition at line 418 of file tmc22xx.cpp.

◆ update_status_()

bool esphome::tmc22xx::TMC22XXStepper::update_status_ ( )
protected

Read GSTAT and DRV_STATUS and report changes. Returns false when the status could not be read.

Definition at line 186 of file tmc22xx.cpp.

◆ write_field()

bool esphome::tmc22xx::TMC22XXStepper::write_field ( const RegisterField & field,
uint32_t value )

Definition at line 492 of file tmc22xx.cpp.

◆ write_register()

bool esphome::tmc22xx::TMC22XXStepper::write_register ( uint8_t reg,
uint32_t value )

Definition at line 438 of file tmc22xx.cpp.

Field Documentation

◆ address_

uint8_t esphome::tmc22xx::TMC22XXStepper::address_ {0}
protected

Definition at line 240 of file tmc22xx.h.

◆ analog_current_scale_

bool esphome::tmc22xx::TMC22XXStepper::analog_current_scale_ {false}
protected

Definition at line 247 of file tmc22xx.h.

◆ clock_frequency_

uint32_t esphome::tmc22xx::TMC22XXStepper::clock_frequency_ {12000000}
protected

Definition at line 224 of file tmc22xx.h.

◆ diag_pin_

InternalGPIOPin* esphome::tmc22xx::TMC22XXStepper::diag_pin_ {nullptr}
protected

Definition at line 222 of file tmc22xx.h.

◆ diag_store_

DiagPinStore esphome::tmc22xx::TMC22XXStepper::diag_store_ {}
protected

Definition at line 246 of file tmc22xx.h.

◆ dir_pin_

GPIOPin* esphome::tmc22xx::TMC22XXStepper::dir_pin_ {nullptr}
protected

Definition at line 220 of file tmc22xx.h.

◆ direction_

int8_t esphome::tmc22xx::TMC22XXStepper::direction_ {0}
protected

Definition at line 245 of file tmc22xx.h.

◆ enabled_

bool esphome::tmc22xx::TMC22XXStepper::enabled_ {false}
protected

Definition at line 248 of file tmc22xx.h.

◆ enn_pin_

GPIOPin* esphome::tmc22xx::TMC22XXStepper::enn_pin_ {nullptr}
protected

Definition at line 218 of file tmc22xx.h.

◆ high_freq_

HighFrequencyLoopRequester esphome::tmc22xx::TMC22XXStepper::high_freq_
protected

Definition at line 252 of file tmc22xx.h.

◆ ihold_irun_

uint32_t esphome::tmc22xx::TMC22XXStepper::ihold_irun_ {0x00071703}
protected

Definition at line 226 of file tmc22xx.h.

◆ index_pin_

InternalGPIOPin* esphome::tmc22xx::TMC22XXStepper::index_pin_ {nullptr}
protected

Definition at line 221 of file tmc22xx.h.

◆ index_store_

IndexPulseStore esphome::tmc22xx::TMC22XXStepper::index_store_ {}
protected

Definition at line 235 of file tmc22xx.h.

◆ initial_hold_current_

float esphome::tmc22xx::TMC22XXStepper::initial_hold_current_ {NAN}
protected

Definition at line 234 of file tmc22xx.h.

◆ initial_microsteps_

uint16_t esphome::tmc22xx::TMC22XXStepper::initial_microsteps_ {16}
protected

Definition at line 236 of file tmc22xx.h.

◆ initial_run_current_

float esphome::tmc22xx::TMC22XXStepper::initial_run_current_ {NAN}
protected

Definition at line 233 of file tmc22xx.h.

◆ moving_

bool esphome::tmc22xx::TMC22XXStepper::moving_ {false}
protected

Definition at line 251 of file tmc22xx.h.

◆ ottrim_

optional<uint8_t> esphome::tmc22xx::TMC22XXStepper::ottrim_ {}
protected

Definition at line 239 of file tmc22xx.h.

◆ restored_values_

std::array<uint32_t, RESTORED_REGISTERS.size()> esphome::tmc22xx::TMC22XXStepper::restored_values_ {}
protected

Definition at line 230 of file tmc22xx.h.

◆ restored_written_

uint8_t esphome::tmc22xx::TMC22XXStepper::restored_written_ {0}
protected

Definition at line 243 of file tmc22xx.h.

◆ rsense_

float esphome::tmc22xx::TMC22XXStepper::rsense_ {NAN}
protected

Definition at line 232 of file tmc22xx.h.

◆ status_

uint16_t esphome::tmc22xx::TMC22XXStepper::status_ {0}
protected

Definition at line 237 of file tmc22xx.h.

◆ status_callback_

LazyCallbackManager<void(DriverEvent, bool)> esphome::tmc22xx::TMC22XXStepper::status_callback_
protected

Definition at line 223 of file tmc22xx.h.

◆ status_poll_skip_

uint8_t esphome::tmc22xx::TMC22XXStepper::status_poll_skip_ {0}
protected

Definition at line 244 of file tmc22xx.h.

◆ step_pin_

GPIOPin* esphome::tmc22xx::TMC22XXStepper::step_pin_ {nullptr}
protected

Definition at line 219 of file tmc22xx.h.

◆ step_state_

bool esphome::tmc22xx::TMC22XXStepper::step_state_ {false}
protected

Definition at line 250 of file tmc22xx.h.

◆ toff_

uint8_t esphome::tmc22xx::TMC22XXStepper::toff_ {3}
protected

Definition at line 241 of file tmc22xx.h.

◆ tpowerdown_

uint32_t esphome::tmc22xx::TMC22XXStepper::tpowerdown_ {0x14}
protected

Definition at line 227 of file tmc22xx.h.

◆ tpwmthrs_

uint32_t esphome::tmc22xx::TMC22XXStepper::tpwmthrs_ {0}
protected

Definition at line 228 of file tmc22xx.h.

◆ vactual_reg_

uint32_t esphome::tmc22xx::TMC22XXStepper::vactual_reg_ {0}
protected

Definition at line 229 of file tmc22xx.h.

◆ version_

uint8_t esphome::tmc22xx::TMC22XXStepper::version_ {0}
protected

Definition at line 242 of file tmc22xx.h.

◆ vsense_

optional<bool> esphome::tmc22xx::TMC22XXStepper::vsense_ {}
protected

Definition at line 238 of file tmc22xx.h.

◆ vsense_active_

bool esphome::tmc22xx::TMC22XXStepper::vsense_active_ {false}
protected

Definition at line 249 of file tmc22xx.h.


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