TMCStepper
TMC2130_bitfields.h
Go to the documentation of this file.
1 #pragma once
2 #pragma pack(push, 1)
3 
4 struct GCONF_t {
5  constexpr static uint8_t address = 0x00;
6  union {
7  uint32_t sr : 18;
8  struct {
9  bool i_scale_analog : 1, // 2130, 5130
10  internal_rsense : 1, // 2130, 5130
12  enc_commutation : 1, // 2130, 5130
13  shaft : 1,
26  };
27  struct { // TMC5160
28  bool recalibrate : 1,
30  : 1,
31  multistep_filt : 1,
32  : 3,
33  diag0_step : 1,
34  diag1_dir : 1,
35  : 4,
37  };
38  };
39 };
40 
41 struct IHOLD_IRUN_t {
42  constexpr static uint8_t address = 0x10;
43  union {
44  uint32_t sr : 20;
45  struct {
46  uint8_t ihold : 5,
47  : 3,
48  irun : 5,
49  : 3,
50  iholddelay : 4;
51  };
52  };
53 };
54 
55 struct GSTAT_t {
56  constexpr static uint8_t address = 0x01;
57  union {
58  uint8_t sr : 3;
59  struct {
60  bool reset : 1,
61  drv_err : 1,
62  uv_cp : 1;
63  };
64  };
65 };
66 
67 struct IOIN_t {
68  constexpr static uint8_t address = 0x04;
69  union {
70  uint32_t sr;
71  struct {
72  bool step : 1,
73  dir : 1,
74  dcen_cfg4 : 1,
75  dcin_cfg5 : 1,
77  dco : 1,
78  : 2;
79  uint16_t : 16;
80  uint8_t version : 8;
81  };
82  };
83 };
84 
85 struct TPOWERDOWN_t {
86  constexpr static uint8_t address = 0x11;
87  uint8_t sr : 8;
88 };
89 
90 struct TPWMTHRS_t {
91  constexpr static uint8_t address = 0x13;
92  uint32_t sr : 20;
93 };
94 
95 struct TCOOLTHRS_t {
96  constexpr static uint8_t address = 0x14;
97  uint32_t sr : 20;
98 };
99 
100 struct THIGH_t {
101  constexpr static uint8_t address = 0x15;
102  uint32_t sr : 20;
103 };
104 
105 struct XDIRECT_t {
106  constexpr static uint8_t address = 0x2D;
107  union {
108  uint32_t sr : 25;
109  struct {
110  int16_t coil_A : 9;
111  int8_t : 7;
112  int16_t coil_B : 9;
113  };
114  };
115 };
116 
117 struct VDCMIN_t {
118  constexpr static uint8_t address = 0x33;
119  uint32_t sr : 23;
120 };
121 
122 struct CHOPCONF_t {
123  constexpr static uint8_t address = 0x6C;
124  union {
125  uint32_t sr : 32;
126  struct {
127  uint8_t toff : 4,
128  hstrt : 3,
129  hend : 4,
130  : 1;
131  bool disfdcc : 1,
132  rndtf : 1,
133  chm : 1;
134  uint8_t tbl : 2;
135  bool vsense : 1,
136  vhighfs : 1,
137  vhighchm : 1;
138  uint8_t sync : 4, // 2130, 5130
139  mres : 4;
140  bool intpol : 1,
141  dedge : 1,
142  diss2g : 1;
143  };
144  struct { // TMC5160
145  uint32_t : 20;
146  uint8_t tpfd : 4; // 5160
147  uint16_t : 7;
148  bool diss2vs : 1; // TMC5160 only
149  };
150  };
151 };
152 
153 struct COOLCONF_t {
154  constexpr static uint8_t address = 0x6D;
155  union {
156  uint32_t sr : 25;
157  struct {
158  uint8_t semin : 4,
159  : 1,
160  seup : 2,
161  : 1,
162  semax : 4,
163  : 1,
164  sedn : 2;
165  bool seimin : 1;
166  int8_t sgt : 7,
167  : 1;
168  bool sfilt : 1;
169  };
170  };
171 };
172 
173 struct DCCTRL_t {
174  constexpr static uint8_t address = 0x6E;
175  union {
176  uint32_t sr : 24;
177  struct {
178  uint16_t dc_time : 10,
179  : 6;
180  uint8_t dc_sg : 8;
181  };
182  };
183 };
184 
185 namespace TMC2130_n {
186  struct DRV_STATUS_t {
187  constexpr static uint8_t address = 0x6F;
188  union {
189  uint32_t sr;
190  struct {
191  uint16_t sg_result : 10;
192  uint8_t : 5;
193  bool fsactive : 1;
194  uint8_t cs_actual : 5,
195  : 3;
196  bool stallGuard : 1,
197  ot : 1,
198  otpw : 1,
199  s2ga : 1,
200  s2gb : 1,
201  ola : 1,
202  olb : 1,
203  stst : 1;
204  };
205  };
206  };
207 }
208 
209 struct PWMCONF_t {
210  constexpr static uint8_t address = 0x70;
211  union {
212  uint32_t sr : 22;
213  struct {
214  uint8_t pwm_ampl : 8,
215  pwm_grad : 8,
216  pwm_freq : 2;
217  bool pwm_autoscale : 1,
219  uint8_t freewheel : 2;
220  };
221  };
222 };
223 
224 struct ENCM_CTRL_t {
225  constexpr static uint8_t address = 0x72;
226  union {
227  uint8_t sr : 2;
228  struct {
229  bool inv : 1,
230  maxspeed : 1;
231  };
232  };
233 };
234 
235 #pragma pack(pop)
COOLCONF_t::seup
uint8_t seup
Definition: TMC2130_bitfields.h:159
IOIN_t::dir
bool dir
Definition: TMC2130_bitfields.h:73
GCONF_t::direct_mode
bool direct_mode
Definition: TMC2130_bitfields.h:25
TMC2130_n::DRV_STATUS_t::olb
uint8_t bool olb
Definition: TMC2130_bitfields.h:202
GSTAT_t::reset
bool reset
Definition: TMC2130_bitfields.h:60
CHOPCONF_t::disfdcc
uint8_t bool disfdcc
Definition: TMC2130_bitfields.h:130
IHOLD_IRUN_t::irun
uint8_t irun
Definition: TMC2130_bitfields.h:47
IHOLD_IRUN_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:42
GCONF_t::diag0_otpw
bool diag0_otpw
Definition: TMC2130_bitfields.h:15
TMC2130_n::DRV_STATUS_t::ola
uint8_t bool ola
Definition: TMC2130_bitfields.h:201
TMC2130_n::DRV_STATUS_t::otpw
uint8_t bool otpw
Definition: TMC2130_bitfields.h:198
VDCMIN_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:119
PWMCONF_t::pwm_grad
uint8_t pwm_grad
Definition: TMC2130_bitfields.h:215
TMC2130_n::DRV_STATUS_t::cs_actual
uint8_t cs_actual
Definition: TMC2130_bitfields.h:194
CHOPCONF_t::mres
uint8_t mres
Definition: TMC2130_bitfields.h:139
GCONF_t::multistep_filt
bool multistep_filt
Definition: TMC2130_bitfields.h:30
GCONF_t::diag0_step
bool diag0_step
Definition: TMC2130_bitfields.h:32
THIGH_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:101
IHOLD_IRUN_t
Definition: TMC2130_bitfields.h:41
COOLCONF_t::sfilt
int8_t bool sfilt
Definition: TMC2130_bitfields.h:167
PWMCONF_t
Definition: TMC2130_bitfields.h:209
GCONF_t::diag0_error
bool diag0_error
Definition: TMC2130_bitfields.h:14
CHOPCONF_t::intpol
bool intpol
Definition: TMC2130_bitfields.h:140
GSTAT_t::uv_cp
bool uv_cp
Definition: TMC2130_bitfields.h:62
GCONF_t::enc_commutation
bool enc_commutation
Definition: TMC2130_bitfields.h:12
IOIN_t::step
bool step
Definition: TMC2130_bitfields.h:72
GCONF_t
Definition: TMC2130_bitfields.h:4
COOLCONF_t::sedn
uint8_t sedn
Definition: TMC2130_bitfields.h:163
PWMCONF_t::pwm_ampl
uint8_t pwm_ampl
Definition: TMC2130_bitfields.h:214
CHOPCONF_t::diss2vs
bool diss2vs
Definition: TMC2130_bitfields.h:148
TMC2130_n::DRV_STATUS_t::stallGuard
uint8_t bool stallGuard
Definition: TMC2130_bitfields.h:195
TPOWERDOWN_t
Definition: TMC2130_bitfields.h:85
GCONF_t::diag1_onstate
bool diag1_onstate
Definition: TMC2130_bitfields.h:19
XDIRECT_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:108
GCONF_t::diag0_int_pushpull
bool diag0_int_pushpull
Definition: TMC2130_bitfields.h:21
TPOWERDOWN_t::sr
uint8_t sr
Definition: TMC2130_bitfields.h:87
TPWMTHRS_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:92
XDIRECT_t
Definition: TMC2130_bitfields.h:105
IOIN_t::dcin_cfg5
bool dcin_cfg5
Definition: TMC2130_bitfields.h:75
CHOPCONF_t::dedge
bool dedge
Definition: TMC2130_bitfields.h:141
IOIN_t::dco
bool dco
Definition: TMC2130_bitfields.h:77
ENCM_CTRL_t::inv
bool inv
Definition: TMC2130_bitfields.h:229
GCONF_t::diag1_steps_skipped
bool diag1_steps_skipped
Definition: TMC2130_bitfields.h:20
GCONF_t::faststandstill
bool faststandstill
Definition: TMC2130_bitfields.h:29
PWMCONF_t::pwm_autoscale
bool pwm_autoscale
Definition: TMC2130_bitfields.h:217
PWMCONF_t::pwm_freq
uint8_t pwm_freq
Definition: TMC2130_bitfields.h:216
TMC2130_n::DRV_STATUS_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:189
GCONF_t::diag0_stall
bool diag0_stall
Definition: TMC2130_bitfields.h:16
GCONF_t::i_scale_analog
bool i_scale_analog
Definition: TMC2130_bitfields.h:9
CHOPCONF_t::rndtf
uint8_t bool rndtf
Definition: TMC2130_bitfields.h:132
PWMCONF_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:210
TPWMTHRS_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:91
CHOPCONF_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:123
CHOPCONF_t::sync
uint8_t sync
Definition: TMC2130_bitfields.h:138
CHOPCONF_t::vsense
bool vsense
Definition: TMC2130_bitfields.h:135
PWMCONF_t::freewheel
uint8_t freewheel
Definition: TMC2130_bitfields.h:219
GCONF_t::recalibrate
bool recalibrate
Definition: TMC2130_bitfields.h:28
TMC2130_n::DRV_STATUS_t::stst
uint8_t bool stst
Definition: TMC2130_bitfields.h:203
GCONF_t::diag1_index
bool diag1_index
Definition: TMC2130_bitfields.h:18
COOLCONF_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:154
TMC2130_n::DRV_STATUS_t::sg_result
uint16_t sg_result
Definition: TMC2130_bitfields.h:191
THIGH_t
Definition: TMC2130_bitfields.h:100
CHOPCONF_t::hend
uint8_t hend
Definition: TMC2130_bitfields.h:129
THIGH_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:102
GCONF_t::small_hysteresis
bool small_hysteresis
Definition: TMC2130_bitfields.h:23
IOIN_t
Definition: TMC2130_bitfields.h:67
GCONF_t::en_pwm_mode
bool en_pwm_mode
Definition: TMC2130_bitfields.h:11
TMC2130_n::DRV_STATUS_t
Definition: TMC2130_bitfields.h:186
GCONF_t::stop_enable
bool stop_enable
Definition: TMC2130_bitfields.h:24
CHOPCONF_t::diss2g
bool diss2g
Definition: TMC2130_bitfields.h:142
DCCTRL_t::dc_time
uint16_t dc_time
Definition: TMC2130_bitfields.h:178
IOIN_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:70
CHOPCONF_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:125
TPOWERDOWN_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:86
GCONF_t::diag1_pushpull
bool diag1_pushpull
Definition: TMC2130_bitfields.h:22
IHOLD_IRUN_t::iholddelay
uint8_t iholddelay
Definition: TMC2130_bitfields.h:49
GSTAT_t::sr
uint8_t sr
Definition: TMC2130_bitfields.h:58
TMC2130_n::DRV_STATUS_t::ot
uint8_t bool ot
Definition: TMC2130_bitfields.h:197
COOLCONF_t::seimin
bool seimin
Definition: TMC2130_bitfields.h:165
ENCM_CTRL_t::maxspeed
bool maxspeed
Definition: TMC2130_bitfields.h:230
CHOPCONF_t::tpfd
uint8_t tpfd
Definition: TMC2130_bitfields.h:146
GSTAT_t::drv_err
bool drv_err
Definition: TMC2130_bitfields.h:61
ENCM_CTRL_t
Definition: TMC2130_bitfields.h:224
TCOOLTHRS_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:97
DCCTRL_t::dc_sg
uint16_t uint8_t dc_sg
Definition: TMC2130_bitfields.h:179
GCONF_t::shaft
bool shaft
Definition: TMC2130_bitfields.h:13
PWMCONF_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:212
IOIN_t::dcen_cfg4
bool dcen_cfg4
Definition: TMC2130_bitfields.h:74
GCONF_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:5
TMC2130_n
Definition: TMC2130_bitfields.h:185
COOLCONF_t::semax
uint8_t semax
Definition: TMC2130_bitfields.h:161
GCONF_t::diag1_stall
bool diag1_stall
Definition: TMC2130_bitfields.h:17
IOIN_t::version
uint8_t version
Definition: TMC2130_bitfields.h:80
COOLCONF_t::semin
uint8_t semin
Definition: TMC2130_bitfields.h:158
TMC2130_n::DRV_STATUS_t::s2ga
uint8_t bool s2ga
Definition: TMC2130_bitfields.h:199
DCCTRL_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:176
XDIRECT_t::coil_B
int16_t coil_B
Definition: TMC2130_bitfields.h:112
GCONF_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:7
GCONF_t::diag1_poscomp_pushpull
bool diag1_poscomp_pushpull
Definition: TMC2130_bitfields.h:35
ENCM_CTRL_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:225
TCOOLTHRS_t
Definition: TMC2130_bitfields.h:95
IOIN_t::drv_enn_cfg6
bool drv_enn_cfg6
Definition: TMC2130_bitfields.h:76
DCCTRL_t
Definition: TMC2130_bitfields.h:173
PWMCONF_t::pwm_symmetric
bool pwm_symmetric
Definition: TMC2130_bitfields.h:218
GSTAT_t
Definition: TMC2130_bitfields.h:55
IOIN_t::uint16_t
bool uint16_t
Definition: TMC2130_bitfields.h:78
COOLCONF_t::sgt
int8_t sgt
Definition: TMC2130_bitfields.h:166
GCONF_t::diag1_dir
bool diag1_dir
Definition: TMC2130_bitfields.h:34
CHOPCONF_t::hstrt
uint8_t hstrt
Definition: TMC2130_bitfields.h:128
CHOPCONF_t::chm
uint8_t bool chm
Definition: TMC2130_bitfields.h:133
CHOPCONF_t::toff
uint8_t toff
Definition: TMC2130_bitfields.h:127
IHOLD_IRUN_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:44
DCCTRL_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:174
CHOPCONF_t::vhighfs
bool vhighfs
Definition: TMC2130_bitfields.h:136
XDIRECT_t::coil_A
int16_t coil_A
Definition: TMC2130_bitfields.h:110
GSTAT_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:56
TMC2130_n::DRV_STATUS_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:187
TMC2130_n::DRV_STATUS_t::fsactive
bool fsactive
Definition: TMC2130_bitfields.h:193
COOLCONF_t::sr
uint32_t sr
Definition: TMC2130_bitfields.h:156
IOIN_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:68
VDCMIN_t
Definition: TMC2130_bitfields.h:117
COOLCONF_t
Definition: TMC2130_bitfields.h:153
GCONF_t::internal_rsense
bool internal_rsense
Definition: TMC2130_bitfields.h:10
CHOPCONF_t::tbl
uint8_t tbl
Definition: TMC2130_bitfields.h:134
TMC2130_n::DRV_STATUS_t::s2gb
uint8_t bool s2gb
Definition: TMC2130_bitfields.h:200
XDIRECT_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:106
CHOPCONF_t
Definition: TMC2130_bitfields.h:122
ENCM_CTRL_t::sr
uint8_t sr
Definition: TMC2130_bitfields.h:227
IHOLD_IRUN_t::ihold
uint8_t ihold
Definition: TMC2130_bitfields.h:46
TCOOLTHRS_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:96
VDCMIN_t::address
constexpr static uint8_t address
Definition: TMC2130_bitfields.h:118
TPWMTHRS_t
Definition: TMC2130_bitfields.h:90
CHOPCONF_t::vhighchm
bool vhighchm
Definition: TMC2130_bitfields.h:137