11#ifndef TMC5160_STATUS_HPP
12#define TMC5160_STATUS_HPP
149[[nodiscard]]
constexpr int32_t SignExtend(uint32_t v, uint32_t bits)
noexcept {
150 const uint32_t sign = uint32_t{1} << (bits - 1U);
151 const uint32_t low = v & ((sign << 1U) - 1U);
152 return static_cast<int32_t
>((low ^ sign)) -
static_cast<int32_t
>(sign);
156[[nodiscard]]
constexpr bool Bit(uint32_t v, uint32_t b)
noexcept {
157 return ((v >> b) & 1U) != 0U;
161[[nodiscard]]
constexpr uint32_t Put(
bool on, uint32_t pos)
noexcept {
162 return static_cast<uint32_t
>(on) << pos;
165[[nodiscard]]
constexpr GlobalStatus DecodeGlobal(uint32_t raw)
noexcept {
166 return GlobalStatus{.
reset = Bit(raw, 0), .drv_err = Bit(raw, 1), .uv_cp = Bit(raw, 2)};
169[[nodiscard]]
constexpr DriverStatus DecodeDriver(uint32_t raw)
noexcept {
172 d.cs_actual = (raw >> 16U) & 0x1FU;
173 d.s2vs_a = Bit(raw, 12);
174 d.s2vs_b = Bit(raw, 13);
175 d.stealth = Bit(raw, 14);
176 d.full_step = Bit(raw, 15);
177 d.stall = Bit(raw, 24);
178 d.over_temp = Bit(raw, 25);
179 d.over_temp_warning = Bit(raw, 26);
180 d.s2g_a = Bit(raw, 27);
181 d.s2g_b = Bit(raw, 28);
182 d.open_load_a = Bit(raw, 29);
183 d.open_load_b = Bit(raw, 30);
184 d.standstill = Bit(raw, 31);
189[[nodiscard]]
constexpr RampStatus DecodeRamp(uint32_t raw)
noexcept {
192 r.stop_right_active = Bit(raw, 1);
193 r.latch_left = Bit(raw, 2);
194 r.latch_right = Bit(raw, 3);
195 r.event_stop_left = Bit(raw, 4);
196 r.event_stop_right = Bit(raw, 5);
197 r.event_stop_stall = Bit(raw, 6);
198 r.event_pos_reached = Bit(raw, 7);
199 r.velocity_reached = Bit(raw, 8);
200 r.position_reached = Bit(raw, 9);
201 r.velocity_zero = Bit(raw, 10);
202 r.zero_wait_active = Bit(raw, 11);
203 r.second_move = Bit(raw, 12);
204 r.stall = Bit(raw, 13);
209[[nodiscard]]
constexpr InputPins DecodeInputs(uint32_t raw)
noexcept {
212 p.refr_dir = Bit(raw, 1);
213 p.encb_dcen = Bit(raw, 2);
214 p.enca_dcin = Bit(raw, 3);
215 p.drv_enn = Bit(raw, 4);
216 p.encn_dco = Bit(raw, 5);
217 p.sd_mode = Bit(raw, 6);
218 p.swcomp_in = Bit(raw, 7);
219 p.version = raw >> 24U;
223[[nodiscard]]
constexpr OtpImage DecodeOtp(uint32_t raw)
noexcept {
225 .s2_level_12 = Bit(raw, 5),
226 .bbm_clks_2 = Bit(raw, 6),
227 .tbl_01 = Bit(raw, 7),
231[[nodiscard]]
constexpr StealthChopState DecodeStealthChop(uint32_t scale,
232 uint32_t autos)
noexcept {
233 return StealthChopState{.
scale_sum = scale & 0xFFU,
234 .scale_auto = SignExtend(scale >> 16U, 9),
235 .ofs_auto = autos & 0xFFU,
236 .grad_auto = (autos >> 16U) & 0xFFU};
239[[nodiscard]]
constexpr MicrostepCurrents DecodeMscuract(uint32_t raw)
noexcept {
240 return MicrostepCurrents{.
cur_a = SignExtend(raw >> 16U, 9), .cur_b = SignExtend(raw, 9)};
244[[nodiscard]]
constexpr uint32_t GconfWord(
const Config& c,
bool direct)
noexcept {
245 const Diag& d = c.diag;
246 uint32_t w = Put(c.flags.recalibrate, 0) | Put(c.standstill.fast_standstill, 1) |
247 Put(c.stealth.enable, 2) | Put(c.flags.multistep_filt, 3) |
248 Put(c.flags.invert_direction, 4);
249 w |= Put(d.diag0_error, 5) | Put(d.diag0_otpw, 6) | Put(d.diag0_stall || d.diag0_step_output, 7);
250 w |= Put(d.diag1_stall || d.diag1_dir_output, 8) | Put(d.diag1_index, 9) |
251 Put(d.diag1_on_state, 10);
252 w |= Put(d.diag1_steps_skipped, 11) | Put(d.diag0_push_pull, 12) | Put(d.diag1_push_pull, 13);
253 w |= Put(c.thresholds.small_hysteresis, 14) | Put(c.flags.stop_input, 15) | Put(direct, 16);
258[[nodiscard]]
constexpr uint32_t ChopconfWord(
const Config& c, uint32_t toff)
noexcept {
259 const Chopper& k = c.chopper;
261 const uint32_t low = const_off ? (k.tfd & 7U) : k.hstrt;
262 const uint32_t high = const_off ? k.offset : k.hend;
263 uint32_t w = toff & 15U;
266 w |= Put(const_off && ((k.tfd & 8U) != 0U), 11) | Put(const_off && k.no_comparator, 12);
267 w |= Put(const_off, 14) | (
static_cast<uint32_t
>(k.tbl & 3U) << 15U);
268 w |= Put(k.high_fullstep, 18) | Put(k.high_const_off, 19) |
269 (
static_cast<uint32_t
>(k.tpfd & 15U) << 20U);
270 w |= (
static_cast<uint32_t
>(k.mres) << 24U) | Put(k.interpolate, 28) | Put(k.double_edge, 29);
271 w |= Put(c.protection.disable_s2g, 30) | Put(c.protection.disable_s2vs, 31);
276[[nodiscard]]
constexpr uint32_t IholdIrunWord(
const units::CurrentPlan& p,
const Standstill& s,
277 uint32_t ihold)
noexcept {
278 return (ihold & 31U) | ((p.irun & 31U) << 8U) |
279 (
static_cast<uint32_t
>(s.hold_delay & 15U) << 16U);
283[[nodiscard]]
constexpr uint32_t PwmconfWord(
const StealthChop& s)
noexcept {
284 return static_cast<uint32_t
>(s.ofs) | (
static_cast<uint32_t
>(s.grad) << 8U) |
285 (
static_cast<uint32_t
>(s.freq & 3U) << 16U) | Put(s.autoscale, 18) | Put(s.autograd, 19) |
286 (
static_cast<uint32_t
>(s.freewheel) << 20U) | (
static_cast<uint32_t
>(s.reg & 15U) << 24U) |
287 (
static_cast<uint32_t
>(s.lim & 15U) << 28U);
291[[nodiscard]]
constexpr uint32_t CoolconfWord(
const CoolStep& k,
const StallGuard& g)
noexcept {
292 return static_cast<uint32_t
>(k.semin & 15U) | (
static_cast<uint32_t
>(k.seup & 3U) << 5U) |
293 (
static_cast<uint32_t
>(k.semax & 15U) << 8U) |
294 (
static_cast<uint32_t
>(k.sedn & 3U) << 13U) | Put(k.min_quarter, 15) |
295 ((
static_cast<uint32_t
>(
static_cast<int32_t
>(g.threshold)) & 0x7FU) << 16U) |
300[[nodiscard]]
constexpr uint32_t DcctrlWord(
const DcStep& d)
noexcept {
301 return static_cast<uint32_t
>(d.dc_time & 0x3FFU) | (
static_cast<uint32_t
>(d.dc_sg) << 16U);
305[[nodiscard]]
constexpr uint32_t ShortconfWord(
const Protection& p)
noexcept {
306 return static_cast<uint32_t
>(p.s2vs_level & 15U) |
307 (
static_cast<uint32_t
>(p.s2g_level & 15U) << 8U) |
308 (
static_cast<uint32_t
>(p.filter & 3U) << 16U) | Put(p.long_delay, 18);
312[[nodiscard]]
constexpr uint32_t DrvconfWord(
const Bridge& b)
noexcept {
313 return static_cast<uint32_t
>(b.bbm_time & 31U) | (
static_cast<uint32_t
>(b.bbm_clks & 15U) << 8U) |
314 (
static_cast<uint32_t
>(b.ot_level) << 16U) |
315 (
static_cast<uint32_t
>(b.drive_strength & 3U) << 18U) |
316 (
static_cast<uint32_t
>(b.sense_filter & 3U) << 20U);
320[[nodiscard]]
constexpr uint32_t SwmodeWord(
const Switches& s)
noexcept {
321 return Put(s.stop_left, 0) | Put(s.stop_right, 1) | Put(s.left_active_low, 2) |
322 Put(s.right_active_low, 3) | Put(s.swap, 4) | Put(s.latch_left_active, 5) |
323 Put(s.latch_left_inactive, 6) | Put(s.latch_right_active, 7) |
324 Put(s.latch_right_inactive, 8) | Put(s.latch_encoder, 9) | Put(s.stop_on_stall, 10) |
325 Put(s.soft_stop, 11);
329[[nodiscard]]
constexpr uint32_t EncmodeWord(
const Encoder& e)
noexcept {
330 const NEvent& n = e.n_event;
331 return Put(n.pol_a, 0) | Put(n.pol_b, 1) | Put(n.pol_n, 2) | Put(n.ignore_ab, 3) |
332 Put(n.repeat, 4) | Put(n.once, 5) | Put(n.pos_edge, 6) | Put(n.neg_edge, 7) |
333 Put(n.clear_counter, 8) | Put(n.latch_xactual, 9) | Put(e.scale.decimal, 10);
337[[nodiscard]]
constexpr uint32_t MslutselWord(
const MicrostepTable& t)
noexcept {
338 return static_cast<uint32_t
>(t.w[0] & 3U) | (
static_cast<uint32_t
>(t.w[1] & 3U) << 2U) |
339 (
static_cast<uint32_t
>(t.w[2] & 3U) << 4U) | (
static_cast<uint32_t
>(t.w[3] & 3U) << 6U) |
340 (
static_cast<uint32_t
>(t.x1) << 8U) | (
static_cast<uint32_t
>(t.x2) << 16U) |
341 (
static_cast<uint32_t
>(t.x3) << 24U);
345[[nodiscard]]
constexpr uint32_t MslutstartWord(
const MicrostepTable& t)
noexcept {
346 return static_cast<uint32_t
>(t.start_sin) | (
static_cast<uint32_t
>(t.start_sin90) << 16U);
350[[nodiscard]]
constexpr uint32_t NodeconfWord(uint32_t node, uint32_t send_delay)
noexcept {
351 return (node & 0xFFU) | ((send_delay & 15U) << 8U);
356 const Config& config;
357 const units::CurrentPlan& plan;
364using WordFn = uint32_t (*)(
const WordContext&)
noexcept;
374inline constexpr std::array<WordEntry, 38> kWordTable{{
376 .encode = [](
const WordContext& x)
noexcept {
return GconfWord(x.config, x.direct); }},
378 .encode = [](
const WordContext& x)
noexcept {
return ShortconfWord(x.config.protection); }},
380 .encode = [](
const WordContext& x)
noexcept {
return DrvconfWord(x.config.bridge); }},
382 .encode = [](
const WordContext& x)
noexcept {
return x.plan.global_scaler_reg; }},
385 [](
const WordContext& x)
noexcept {
386 return IholdIrunWord(x.plan, x.config.standstill,
387 x.hold_at_run ? x.plan.irun : x.plan.ihold);
391 [](
const WordContext& x)
noexcept {
392 return uint32_t{x.config.standstill.power_down_delay};
395 .encode = [](
const WordContext& x)
noexcept {
return x.config.thresholds.pwm; }},
397 .encode = [](
const WordContext& x)
noexcept {
return x.config.thresholds.cool; }},
399 .encode = [](
const WordContext& x)
noexcept {
return x.config.thresholds.high; }},
401 .encode = [](
const WordContext& x)
noexcept {
return x.config.ramp.vstart; }},
402 {.address =
reg::kA1, .encode = [](
const WordContext& x)
noexcept {
return x.config.ramp.a1; }},
403 {.address =
reg::kV1, .encode = [](
const WordContext& x)
noexcept {
return x.config.ramp.v1; }},
405 .encode = [](
const WordContext& x)
noexcept {
return x.config.ramp.amax; }},
407 .encode = [](
const WordContext& x)
noexcept {
return x.config.ramp.vmax; }},
409 .encode = [](
const WordContext& x)
noexcept {
return x.config.ramp.dmax; }},
410 {.address =
reg::kD1, .encode = [](
const WordContext& x)
noexcept {
return x.config.ramp.d1; }},
412 .encode = [](
const WordContext& x)
noexcept {
return x.config.ramp.vstop; }},
414 .encode = [](
const WordContext& x)
noexcept {
return x.config.ramp.zero_wait; }},
416 .encode = [](
const WordContext& x)
noexcept {
return x.config.dcstep.vdcmin; }},
418 .encode = [](
const WordContext& x)
noexcept {
return SwmodeWord(x.config.switches); }},
420 .encode = [](
const WordContext& x)
noexcept {
return EncmodeWord(x.config.encoder); }},
423 [](
const WordContext& x)
noexcept {
return units::EncConstWord(x.config.encoder.scale); }},
425 .encode = [](
const WordContext& x)
noexcept {
return x.config.encoder.deviation; }},
427 .encode = [](
const WordContext& x)
noexcept {
return x.config.table.words[0]; }},
429 .encode = [](
const WordContext& x)
noexcept {
return x.config.table.words[1]; }},
431 .encode = [](
const WordContext& x)
noexcept {
return x.config.table.words[2]; }},
433 .encode = [](
const WordContext& x)
noexcept {
return x.config.table.words[3]; }},
435 .encode = [](
const WordContext& x)
noexcept {
return x.config.table.words[4]; }},
437 .encode = [](
const WordContext& x)
noexcept {
return x.config.table.words[5]; }},
439 .encode = [](
const WordContext& x)
noexcept {
return x.config.table.words[6]; }},
441 .encode = [](
const WordContext& x)
noexcept {
return x.config.table.words[7]; }},
443 .encode = [](
const WordContext& x)
noexcept {
return MslutselWord(x.config.table); }},
445 .encode = [](
const WordContext& x)
noexcept {
return MslutstartWord(x.config.table); }},
448 [](
const WordContext& x)
noexcept {
449 return ChopconfWord(x.config, x.enabled ? x.config.chopper.toff : 0U);
453 [](
const WordContext& x)
noexcept {
return CoolconfWord(x.config.cool, x.config.stall); }},
455 .encode = [](
const WordContext& x)
noexcept {
return DcctrlWord(x.config.dcstep); }},
457 .encode = [](
const WordContext& x)
noexcept {
return PwmconfWord(x.config.stealth); }},
460 [](
const WordContext& x)
noexcept {
461 return NodeconfWord(x.config.uart.node, x.config.uart.send_delay);
471[[nodiscard]]
constexpr uint32_t WordFor(
const WordContext& x, uint8_t address)
noexcept {
472 for (
const WordEntry& e : kWordTable) {
473 if (e.address == address) {
485static_assert((SignExtend(0x1FFU, 9) == -1) && (SignExtend(0x0FFU, 9) == 255));
486static_assert((DecodeMscuract(0x01FF0001U).
cur_a == -1) &&
487 (DecodeMscuract(0x01FF0001U).
cur_b == 1));
constexpr uint8_t kThigh
THIGH (W, 20 bits), page 39.
Definition tmc5160_registers.hpp:51
constexpr uint8_t kPwmconf
PWMCONF (W, 32 bits), page 48.
Definition tmc5160_registers.hpp:84
constexpr uint8_t kCoolconf
COOLCONF (W, 25 bits), page 48.
Definition tmc5160_registers.hpp:81
constexpr uint8_t kDmax
DMAX (W, 16 bits), page 40.
Definition tmc5160_registers.hpp:60
constexpr uint8_t kSwMode
SW_MODE (RW, 12 bits), page 42.
Definition tmc5160_registers.hpp:66
constexpr uint32_t kPwmconfReset
Reset value of PWMCONF (page 48).
Definition tmc5160_registers.hpp:123
constexpr uint32_t kDefaultMslutstart
Reset value of MSLUTSTART: START_SIN 0, START_SIN90 247 (page 47).
Definition tmc5160_registers.hpp:119
constexpr uint8_t kVstart
VSTART (W, 18 bits), page 40.
Definition tmc5160_registers.hpp:55
constexpr uint8_t kGconf
GCONF (RW, 18 bits), page 32.
Definition tmc5160_registers.hpp:32
constexpr uint8_t kV1
V1 (W, 20 bits), page 40.
Definition tmc5160_registers.hpp:57
constexpr uint8_t kTzerowait
TZEROWAIT (W, 16 bits), page 41.
Definition tmc5160_registers.hpp:63
constexpr uint32_t kDefaultMslutsel
Reset value of MSLUTSEL (page 47).
Definition tmc5160_registers.hpp:117
constexpr uint8_t kShortConf
SHORT_CONF (W, 19 bits), page 35.
Definition tmc5160_registers.hpp:42
constexpr uint8_t kNodeconf
NODECONF (W, 12 bits): UART node, page 34.
Definition tmc5160_registers.hpp:35
constexpr uint8_t kGlobalScaler
GLOBALSCALER (W, 8 bits), page 36.
Definition tmc5160_registers.hpp:44
constexpr uint8_t kMslutsel
MSLUTSEL (W, 32 bits), page 47.
Definition tmc5160_registers.hpp:76
constexpr uint8_t kTcoolthrs
TCOOLTHRS (W, 20 bits), page 39.
Definition tmc5160_registers.hpp:50
constexpr uint8_t kVdcmin
VDCMIN (W, 23 bits), page 42.
Definition tmc5160_registers.hpp:65
constexpr uint8_t kA1
A1 (W, 16 bits), page 40.
Definition tmc5160_registers.hpp:56
constexpr uint8_t kMslutstart
MSLUTSTART (W, 24 bits), page 47.
Definition tmc5160_registers.hpp:77
constexpr uint8_t kAmax
AMAX (W, 16 bits), page 40.
Definition tmc5160_registers.hpp:58
constexpr uint8_t kTpowerdown
TPOWERDOWN (W, 8 bits), page 38.
Definition tmc5160_registers.hpp:47
constexpr uint8_t kEncmode
ENCMODE (RW, 11 bits), page 45.
Definition tmc5160_registers.hpp:69
constexpr uint8_t kTpwmthrs
TPWMTHRS (W, 20 bits), page 39.
Definition tmc5160_registers.hpp:49
constexpr uint8_t kD1
D1 (W, 16 bits), page 40.
Definition tmc5160_registers.hpp:61
constexpr uint8_t kIholdIrun
IHOLD_IRUN (W, 20 bits), page 38.
Definition tmc5160_registers.hpp:46
constexpr uint8_t kDrvConf
DRV_CONF (W, 22 bits), page 35.
Definition tmc5160_registers.hpp:43
constexpr uint32_t kChopconfReset
Reset value of CHOPCONF (page 48).
Definition tmc5160_registers.hpp:121
constexpr uint8_t kEncConst
ENC_CONST (W, 32 bits), page 45.
Definition tmc5160_registers.hpp:71
constexpr uint8_t kVmax
VMAX (W, 23 bits), page 40.
Definition tmc5160_registers.hpp:59
constexpr uint8_t kChopconf
CHOPCONF (RW, 32 bits), page 48.
Definition tmc5160_registers.hpp:80
constexpr uint8_t kVstop
VSTOP (W, 18 bits), page 41.
Definition tmc5160_registers.hpp:62
constexpr uint8_t kDcctrl
DCCTRL (W, 24 bits), page 48.
Definition tmc5160_registers.hpp:82
constexpr uint8_t kEncDeviation
ENC_DEVIATION (W, 20 bits), page 45.
Definition tmc5160_registers.hpp:74
@ ConstOffTime
Classic constant off time.
The TMC5160 driver: everything it declares lives here; internals in detail.
Definition tmc5160.hpp:34
What start-up learned about the chip.
Definition tmc5160_status.hpp:136
uint32_t advisories
Advise() of the configuration.
Definition tmc5160_status.hpp:141
uint32_t current_hold_ma
The nominal hold current the registers give.
Definition tmc5160_status.hpp:143
bool sd_mode
IOIN.SD_MODE: the strap level.
Definition tmc5160_status.hpp:138
uint32_t current_run_ma
The nominal run current the registers give.
Definition tmc5160_status.hpp:142
bool stall_latched
RAMP_STAT held a stall stop from the last session (not cleared).
Definition tmc5160_status.hpp:140
uint32_t version
IOIN.VERSION.
Definition tmc5160_status.hpp:137
bool uv_cp_seen
GSTAT showed a charge pump undervoltage at start-up.
Definition tmc5160_status.hpp:139
DRV_STATUS, decoded (page 56).
Definition tmc5160_status.hpp:31
uint32_t cs_actual
Actual current scale, 0 to 31.
Definition tmc5160_status.hpp:33
bool over_temp
Overtemperature shutdown.
Definition tmc5160_status.hpp:39
bool standstill
The motor is at standstill.
Definition tmc5160_status.hpp:45
bool open_load_b
Open load, phase B (informative).
Definition tmc5160_status.hpp:44
bool s2vs_a
Short to supply, phase A.
Definition tmc5160_status.hpp:34
bool s2g_b
Short to ground, phase B.
Definition tmc5160_status.hpp:42
uint32_t sg_result
StallGuard2 result, 0 to 1023.
Definition tmc5160_status.hpp:32
bool s2vs_b
Short to supply, phase B.
Definition tmc5160_status.hpp:35
bool full_step
Full-step mode is active.
Definition tmc5160_status.hpp:37
bool open_load_a
Open load, phase A (informative).
Definition tmc5160_status.hpp:43
bool stealth
StealthChop is active.
Definition tmc5160_status.hpp:36
bool stall
StallGuard2 reports a stall.
Definition tmc5160_status.hpp:38
bool over_temp_warning
Overtemperature pre-warning.
Definition tmc5160_status.hpp:40
bool s2g_a
Short to ground, phase A.
Definition tmc5160_status.hpp:41
uint32_t raw
The register as read.
Definition tmc5160_status.hpp:46
ENC_STATUS, decoded (page 45).
Definition tmc5160_status.hpp:69
bool deviation_warn
The encoder deviates from XACTUAL.
Definition tmc5160_status.hpp:71
bool n_event
An N event was detected.
Definition tmc5160_status.hpp:70
What Service() found and cleared.
Definition tmc5160_status.hpp:117
GlobalStatus global
GSTAT at the time of the call.
Definition tmc5160_status.hpp:118
DriverStatus driver
DRV_STATUS at the time of the call.
Definition tmc5160_status.hpp:121
EncoderStatus encoder
ENC_STATUS at the time of the call (zero in StepDir mode).
Definition tmc5160_status.hpp:120
RampStatus ramp
RAMP_STAT at the time of the call.
Definition tmc5160_status.hpp:119
GSTAT, decoded (page 33).
Definition tmc5160_status.hpp:24
bool reset
The chip was reset since GSTAT was last cleared.
Definition tmc5160_status.hpp:25
bool drv_err
The driver shut down on overtemperature or a short.
Definition tmc5160_status.hpp:26
bool uv_cp
Charge pump undervoltage was seen.
Definition tmc5160_status.hpp:27
MSCURACT, decoded (page 47): the unscaled microstep currents, -255 to 255.
Definition tmc5160_status.hpp:111
int32_t cur_a
Phase A (bits 24 to 16).
Definition tmc5160_status.hpp:112
int32_t cur_b
Phase B (bits 8 to 0).
Definition tmc5160_status.hpp:113
OFFSET_READ, decoded (page 36).
Definition tmc5160_status.hpp:88
int32_t phase_b
Offset calibration of phase B, signed.
Definition tmc5160_status.hpp:90
int32_t phase_a
Offset calibration of phase A, signed.
Definition tmc5160_status.hpp:89
OTP_READ, decoded (page 35, 37).
Definition tmc5160_status.hpp:94
bool tbl_01
TBL defaults to %01 instead of %10.
Definition tmc5160_status.hpp:98
bool s2_level_12
Short levels default to 12 instead of 6.
Definition tmc5160_status.hpp:96
uint32_t clock_trim
FCLKTRIM, 5 bits.
Definition tmc5160_status.hpp:95
uint32_t raw
The register as read.
Definition tmc5160_status.hpp:99
bool bbm_clks_2
BBMCLKS defaults to 2 instead of 4.
Definition tmc5160_status.hpp:97
RAMP_STAT, decoded (page 44).
Definition tmc5160_status.hpp:50
bool event_pos_reached
The target position was reached.
Definition tmc5160_status.hpp:58
bool latch_right
A right latch is ready.
Definition tmc5160_status.hpp:54
bool event_stop_stall
A stall stop event.
Definition tmc5160_status.hpp:57
bool stop_left_active
The left switch is active.
Definition tmc5160_status.hpp:51
bool position_reached
XACTUAL equals XTARGET.
Definition tmc5160_status.hpp:60
bool latch_left
A left latch is ready.
Definition tmc5160_status.hpp:53
bool velocity_zero
VACTUAL is zero.
Definition tmc5160_status.hpp:61
bool zero_wait_active
TZEROWAIT is running.
Definition tmc5160_status.hpp:62
bool event_stop_left
A left stop event.
Definition tmc5160_status.hpp:55
bool velocity_reached
VACTUAL equals VMAX.
Definition tmc5160_status.hpp:59
uint32_t raw
The register as read.
Definition tmc5160_status.hpp:65
bool event_stop_right
A right stop event.
Definition tmc5160_status.hpp:56
bool second_move
The ramp reversed direction.
Definition tmc5160_status.hpp:63
bool stop_right_active
The right switch is active.
Definition tmc5160_status.hpp:52
bool stall
The stall input is active.
Definition tmc5160_status.hpp:64
One pipelined batch of the values a monitor wants together.
Definition tmc5160_status.hpp:125
int32_t velocity
VACTUAL, signed.
Definition tmc5160_status.hpp:130
GlobalStatus global
GSTAT.
Definition tmc5160_status.hpp:126
RampStatus ramp
RAMP_STAT.
Definition tmc5160_status.hpp:128
uint32_t step_time
TSTEP.
Definition tmc5160_status.hpp:131
DriverStatus driver
DRV_STATUS.
Definition tmc5160_status.hpp:127
int32_t position
XACTUAL.
Definition tmc5160_status.hpp:129
uint32_t mscnt
MSCNT.
Definition tmc5160_status.hpp:132
PWM_SCALE and PWM_AUTO, decoded (page 48).
Definition tmc5160_status.hpp:103
uint32_t ofs_auto
PWM_OFS_AUTO.
Definition tmc5160_status.hpp:106
int32_t scale_auto
PWM_SCALE_AUTO, signed 9 bits; near 0 after a successful tuning.
Definition tmc5160_status.hpp:105
uint32_t scale_sum
PWM_SCALE_SUM, the actual duty, 0 to 255.
Definition tmc5160_status.hpp:104
uint32_t grad_auto
PWM_GRAD_AUTO.
Definition tmc5160_status.hpp:107
TMC5160 register map: addresses, access rules, reserved bits and reset values.
Public types of the TMC5160 driver: errors, Result<T>, configuration, validation and advice.
Pure integer conversions between datasheet register units and physical units, and the current plan th...