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

Motor current calculation functions for TMC51x0 (TMC5130 & TMC5160) More...

#include "../tmc51x0_types.hpp"
#include <algorithm>
#include <array>
#include <cmath>
Include dependency graph for tmc51x0_motor_calc.hpp:

Go to the source code of this file.

Namespaces

namespace  tmc51x0
 
namespace  tmc51x0::MotorCalcConstants
 

Functions

bool tmc51x0::CalculateMotorCurrent (const MotorSpec &motor_spec, uint32_t sense_resistor_mohm, uint32_t supply_voltage_mv, uint16_t run_current_ma, uint16_t hold_current_ma, uint8_t &irun, uint8_t &ihold, uint16_t &global_scaler) noexcept
 Calculate motor current settings from physical parameters.
 
uint16_t tmc51x0::CalculateStealthChopLowerLimit (const MotorSpec &motor_spec, uint32_t supply_voltage_mv, uint8_t tbl, uint8_t pwm_freq, uint32_t f_clk=12000000U) noexcept
 Calculate StealthChop lower current limit.
 
uint16_t tmc51x0::CalculateMaxCurrentForSenseResistor (uint32_t sense_resistor_mohm) noexcept
 Calculate maximum RMS current for a given sense resistor.
 
uint8_t tmc51x0::CalculateS2VSLevel (uint16_t voltage_mv) noexcept
 Calculate S2VS_LEVEL register value from voltage threshold.
 
uint8_t tmc51x0::CalculateS2GLevel (uint16_t voltage_mv, uint32_t supply_voltage_mv=0) noexcept
 Calculate S2G_LEVEL register value from voltage threshold.
 
uint8_t tmc51x0::CalculateShortDelay (uint8_t delay_us_x10) noexcept
 Calculate shortdelay register bit from detection delay time.
 

Variables

constexpr float tmc51x0::MotorCalcConstants::VFS_MV = 325.0F
 
constexpr float tmc51x0::MotorCalcConstants::SQRT2 = 1.41421356237F
 

Detailed Description

Motor current calculation functions for TMC51x0 (TMC5130 & TMC5160)