20#ifndef TMC5160_KCONFIG_HPP
21#define TMC5160_KCONFIG_HPP
24#if __has_include("sdkconfig.h")
40#if defined(CONFIG_TMC5160_MOTOR_RATED_MA) && defined(CONFIG_TMC5160_RSENSE_MOHM) && \
41 defined(CONFIG_TMC5160_SUPPLY_MV)
43 motor.
rated_rms_ma =
static_cast<uint32_t
>(CONFIG_TMC5160_MOTOR_RATED_MA);
44#ifdef CONFIG_TMC5160_MOTOR_MAX_MA
45 motor.max_rms_ma =
static_cast<uint32_t
>(CONFIG_TMC5160_MOTOR_MAX_MA);
48 board.
rsense_mohm =
static_cast<uint32_t
>(CONFIG_TMC5160_RSENSE_MOHM);
49 board.supply_mv =
static_cast<uint32_t
>(CONFIG_TMC5160_SUPPLY_MV);
51#if defined(CONFIG_TMC5160_RUN_MA) && (CONFIG_TMC5160_RUN_MA > 0)
52 c.
current.
run_ma =
static_cast<uint32_t
>(CONFIG_TMC5160_RUN_MA);
55#if defined(CONFIG_TMC5160_HOLD_MA) && (CONFIG_TMC5160_HOLD_MA > 0)
57#elif defined(CONFIG_TMC5160_RUN_MA) && (CONFIG_TMC5160_RUN_MA > 0)
60#ifdef CONFIG_TMC5160_MRES
63#if defined(CONFIG_TMC5160_STEALTHCHOP) && CONFIG_TMC5160_STEALTHCHOP
66#ifdef CONFIG_TMC5160_UART_BAUD
67 c.
uart.
baud =
static_cast<uint32_t
>(CONFIG_TMC5160_UART_BAUD);
69#ifdef CONFIG_TMC5160_UART_NODE
70 c.
uart.
node =
static_cast<uint8_t
>(CONFIG_TMC5160_UART_NODE);
72#ifdef CONFIG_TMC5160_SPI_CHAIN_LENGTH
73 c.
spi.
chain_length =
static_cast<uint8_t
>(CONFIG_TMC5160_SPI_CHAIN_LENGTH);
75#ifdef CONFIG_TMC5160_SPI_CHAIN_INDEX
76 c.
spi.
chain_index =
static_cast<uint8_t
>(CONFIG_TMC5160_SPI_CHAIN_INDEX);
78#if defined(CONFIG_TMC5160_VERIFY_STARTUP) && CONFIG_TMC5160_VERIFY_STARTUP
Microsteps
Microstep resolution (CHOPCONF.MRES): the value is the shift from 256 microsteps.
Definition tmc5160_types.hpp:226
constexpr Config MakeConfig(const Motor &motor, const Board &board) noexcept
A valid configuration for a declared motor and power stage: run current 90 percent of the rated curre...
Definition tmc5160_types.hpp:952
@ ReadBack
Read the register back where the chip allows it (one or two transfers).
The TMC5160 driver: everything it declares lives here; internals in detail.
Definition tmc5160.hpp:34
constexpr Config KconfigDefaults() noexcept
The configuration menuconfig selected.
Definition tmc5160_kconfig.hpp:39
The power stage as built: the sense resistor and the supply.
Definition tmc5160_types.hpp:319
uint32_t rsense_mohm
Sense resistor per coil in mOhm. Required, 1 or more.
Definition tmc5160_types.hpp:320
Microsteps mres
Microstep resolution.
Definition tmc5160_types.hpp:355
Everything EnsureInitialized() writes to the chip. See docs/configuration.md.
Definition tmc5160_types.hpp:536
UartOptions uart
UART options.
Definition tmc5160_types.hpp:561
StealthChop stealth
StealthChop.
Definition tmc5160_types.hpp:547
Chopper chopper
Chopper.
Definition tmc5160_types.hpp:546
SpiOptions spi
SPI options.
Definition tmc5160_types.hpp:562
Current current
Run and hold current.
Definition tmc5160_types.hpp:544
Verify verify
Verification the start-up uses on its writes.
Definition tmc5160_types.hpp:563
uint32_t hold_ma
Standstill current in mA; at most run_ma unless Ack::HoldAboveRun.
Definition tmc5160_types.hpp:334
uint32_t run_ma
Run current in mA, 1 or more.
Definition tmc5160_types.hpp:333
The motor as its data sheet declares it; the current ceiling comes from here.
Definition tmc5160_types.hpp:310
uint32_t rated_rms_ma
Rated coil current, RMS, in mA. Required, 1 or more.
Definition tmc5160_types.hpp:311
uint8_t chain_index
This chip: 0 is the one whose SDI is on MOSI.
Definition tmc5160_types.hpp:532
uint8_t chain_length
Chips in the daisy chain, 1 to kMaxChain.
Definition tmc5160_types.hpp:531
bool enable
GCONF.en_pwm_mode.
Definition tmc5160_types.hpp:364
uint8_t node
NODEADDR 0 to 253 (254 only inside the addressing procedure).
Definition tmc5160_types.hpp:523
uint32_t baud
Baud rate the port runs; 9000 to fCLK / 16.
Definition tmc5160_types.hpp:526
Public types of the TMC5160 driver: errors, Result<T>, configuration, validation and advice.