TMCStepper
Library supporting Trinamic Stepper Drivers for Arduino platforms
Loading...
Searching...
No Matches
TMC2208_bitfields.h
Go to the documentation of this file.
1
15#pragma once
16#pragma pack(push, 1)
17
18namespace TMC2208_n {
19 struct GCONF_t {
20 constexpr static uint8_t address = 0x00;
21 union {
22 uint16_t sr;
23 struct {
27 shaft : 1,
34 : 6; // unused
35 };
36 };
37 };
38
39 struct IOIN_t {
40 constexpr static uint8_t address = 0x06;
41 union {
42 uint32_t sr;
43 struct {
44 bool enn : 1,
45 : 1, // unused
46 ms1 : 1,
47 ms2 : 1,
48 diag : 1,
49 : 1, // unused
51 step : 1,
52 sel_a : 1,
53 dir : 1;
54 uint16_t : 14; // unused
55 uint8_t version : 8;
56 };
57 };
58 };
59}
60
61namespace TMC2224_n {
62 struct IOIN_t {
63 constexpr static uint8_t address = 0x06;
64 union {
65 uint32_t sr;
66 struct {
67 bool : 1, // unused
69 spread : 1,
70 dir : 1,
71 enn : 1,
72 step : 1,
73 ms1 : 1,
74 ms2 : 1,
75 sel_a : 1;
76 uint16_t : 15; // unused
77 uint8_t version : 8;
78 };
79 };
80 };
81}
82
84 constexpr static uint8_t address = 0x07;
85 union {
86 uint16_t sr;
87 struct {
88 uint8_t fclktrim : 5,
89 : 3, // unused
90 ottrim : 2,
91 : 6; // unused
92 };
93 };
94};
95
96namespace TMC2208_n {
97
98 struct VACTUAL_t {
99 constexpr static uint8_t address = 0x22;
100 uint32_t sr;
101 };
102
103 // 0x6B MSCURACT: Actual Microstep Current (RO)
104 struct MSCURACT_t {
105 constexpr static uint8_t address = 0x6B;
106 union {
107 uint32_t sr;
108 struct {
109 int16_t cur_a : 9,
110 : 7, // unused
111 cur_b : 9,
112 : 7; // unused
113 };
114 };
115 };
116
117 struct CHOPCONF_t {
118 constexpr static uint8_t address = 0x6C;
119 union {
120 uint32_t sr; // 0x10000053
121 struct {
122 uint8_t toff : 4, // 3
123 hstrt : 3, // 5
124 hend : 4, // 0
125 : 4, // unused
126 tbl : 2; // 0
127 bool vsense : 1; // false
128 uint8_t : 6, // unused
129 mres : 4; // 0
130 bool intpol : 1, // true
131 dedge : 1, // false
132 diss2g : 1, // false
133 diss2vs : 1; // false
134 };
135 };
136 };
137
138 struct PWMCONF_t {
139 constexpr static uint8_t address = 0x70;
140 union {
141 uint32_t sr; // 0xC10D0024
142 struct {
143 uint8_t pwm_ofs : 8, // 36
144 pwm_grad : 8, // 0
145 pwm_freq : 2; // 1
146 bool pwm_autoscale : 1, // true
147 pwm_autograd : 1; // true
148 uint8_t freewheel : 2, // 0
149 : 2, // unused
150 pwm_reg : 4, // 1
151 pwm_lim : 4; // 12
152 };
153 };
154 };
155
157 constexpr static uint8_t address = 0x6F;
158 union {
159 uint32_t sr;
160 struct {
161 bool otpw : 1,
162 ot : 1,
163 s2ga : 1,
164 s2gb : 1,
165 s2vsa : 1,
166 s2vsb : 1,
167 ola : 1,
168 olb : 1,
169 t120 : 1,
170 t143 : 1,
171 t150 : 1,
172 t157 : 1,
173 : 4; // unused
174 uint8_t cs_actual : 5;
175 uint16_t : 9; // unused
176 bool stealth : 1,
177 stst : 1;
178 };
179 };
180 };
181
182 struct PWM_SCALE_t {
183 constexpr static uint8_t address = 0x71;
184 union {
185 uint32_t sr;
186 struct {
187 uint8_t pwm_scale_sum : 8,
188 : 8; // unused
189 int16_t pwm_scale_auto : 9,
190 : 7; // unused
191 };
192 };
193 };
194} // TMC2208_n
195
196#pragma pack(pop)
static constexpr uint8_t address
static constexpr uint8_t address
static constexpr uint8_t address
static constexpr uint8_t address
static constexpr uint8_t address
static constexpr uint8_t address
uint8_t int16_t pwm_scale_auto
static constexpr uint8_t address
static constexpr uint8_t address
static constexpr uint8_t address
static constexpr uint8_t address