Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
TMC2209_bitfields.h
00001 #pragma once 00002 #pragma pack(push, 1) 00003 00004 namespace TMC2209_n { 00005 struct IOIN_t { 00006 constexpr static uint8_t address = 0x06; 00007 union { 00008 uint32_t sr; 00009 struct { 00010 bool enn : 1, 00011 : 1, 00012 ms1 : 1, 00013 ms2 : 1, 00014 diag : 1, 00015 : 1, 00016 pdn_uart : 1, 00017 step : 1, 00018 spread_en : 1, 00019 dir : 1; 00020 uint16_t : 14; 00021 uint8_t version : 8; 00022 }; 00023 }; 00024 }; 00025 00026 struct SGTHRS_t { 00027 constexpr static uint8_t address = 0x40; 00028 uint8_t sr : 8; 00029 }; 00030 00031 struct SG_RESULT_t { 00032 constexpr static uint8_t address = 0x41; 00033 uint16_t sr : 10; 00034 }; 00035 00036 struct COOLCONF_t { 00037 constexpr static uint8_t address = 0x42; 00038 union { 00039 uint16_t sr; 00040 struct { 00041 uint8_t semin : 4, 00042 : 1, 00043 seup : 2, 00044 : 1, 00045 semax : 4, 00046 : 1, 00047 sedn : 2; 00048 bool seimin : 1; 00049 }; 00050 }; 00051 }; 00052 00053 } //namespace 00054 ////////////////////////////////////////////////////// 00055 struct SLAVECONF_t { 00056 constexpr static uint8_t address = 0x03; 00057 union { 00058 uint16_t sr : 12; 00059 struct { 00060 uint8_t slaveaddr : 8; 00061 uint8_t senddelay : 4; 00062 }; 00063 }; 00064 }; 00065 00066 struct PWM_AUTO_t { 00067 constexpr static uint8_t address = 0x72; 00068 union { 00069 uint32_t sr : 24; 00070 struct { 00071 uint8_t pwm_ofs_auto : 8, 00072 : 8, 00073 pwm_grad_auto : 8; 00074 }; 00075 }; 00076 }; 00077 00078 struct GCONF_t { 00079 constexpr static uint8_t address = 0x00; 00080 union { 00081 uint32_t sr : 18; 00082 struct { 00083 bool i_scale_analog : 1, // 2130, 5130 00084 internal_rsense : 1, // 2130, 5130 00085 en_pwm_mode : 1, 00086 enc_commutation : 1, // 2130, 5130 00087 shaft : 1, 00088 diag0_error : 1, 00089 diag0_otpw : 1, 00090 diag0_stall : 1, 00091 diag1_stall : 1, 00092 diag1_index : 1, 00093 diag1_onstate : 1, 00094 diag1_steps_skipped : 1, 00095 diag0_int_pushpull : 1, 00096 diag1_pushpull : 1, 00097 small_hysteresis : 1, 00098 stop_enable : 1, 00099 direct_mode : 1; 00100 }; 00101 struct { // TMC5160 00102 bool recalibrate : 1, 00103 faststandstill : 1, 00104 : 1, 00105 multistep_filt : 1, 00106 : 3, 00107 diag0_step : 1, 00108 diag1_dir : 1, 00109 : 4, 00110 diag1_poscomp_pushpull : 1; 00111 }; 00112 }; 00113 }; 00114 00115 struct IHOLD_IRUN_t { 00116 constexpr static uint8_t address = 0x10; 00117 union { 00118 uint32_t sr : 20; 00119 struct { 00120 uint8_t ihold : 5, 00121 : 3, 00122 irun : 5, 00123 : 3, 00124 iholddelay : 4; 00125 }; 00126 }; 00127 }; 00128 00129 struct GSTAT_t { 00130 constexpr static uint8_t address = 0x01; 00131 union { 00132 uint8_t sr : 3; 00133 struct { 00134 bool reset : 1, 00135 drv_err : 1, 00136 uv_cp : 1; 00137 }; 00138 }; 00139 }; 00140 00141 struct TPOWERDOWN_t { 00142 constexpr static uint8_t address = 0x11; 00143 uint8_t sr : 8; 00144 }; 00145 00146 struct TPWMTHRS_t { 00147 constexpr static uint8_t address = 0x13; 00148 uint32_t sr : 20; 00149 }; 00150 00151 struct TCOOLTHRS_t { 00152 constexpr static uint8_t address = 0x14; 00153 uint32_t sr : 20; 00154 }; 00155 00156 struct THIGH_t { 00157 constexpr static uint8_t address = 0x15; 00158 uint32_t sr : 20; 00159 }; 00160 00161 struct XDIRECT_t { 00162 constexpr static uint8_t address = 0x2D; 00163 union { 00164 uint32_t sr : 25; 00165 struct { 00166 int16_t coil_A : 9; 00167 int8_t : 7; 00168 int16_t coil_B : 9; 00169 }; 00170 }; 00171 }; 00172 00173 struct VDCMIN_t { 00174 constexpr static uint8_t address = 0x33; 00175 uint32_t sr : 23; 00176 }; 00177 00178 struct CHOPCONF_t { 00179 constexpr static uint8_t address = 0x6C; 00180 union { 00181 uint32_t sr : 32; 00182 struct { 00183 uint8_t toff : 4, 00184 hstrt : 3, 00185 hend : 4, 00186 : 1; 00187 bool disfdcc : 1, 00188 rndtf : 1, 00189 chm : 1; 00190 uint8_t tbl : 2; 00191 bool vsense : 1, 00192 vhighfs : 1, 00193 vhighchm : 1; 00194 uint8_t sync : 4, // 2130, 5130 00195 mres : 4; 00196 bool intpol : 1, 00197 dedge : 1, 00198 diss2g : 1; 00199 }; 00200 struct { // TMC5160 00201 uint32_t : 20; 00202 uint8_t tpfd : 4; // 5160 00203 uint16_t : 7; 00204 bool diss2vs : 1; // TMC5160 only 00205 }; 00206 }; 00207 }; 00208 00209 struct DCCTRL_t { 00210 constexpr static uint8_t address = 0x6E; 00211 union { 00212 uint32_t sr : 24; 00213 struct { 00214 uint16_t dc_time : 10, 00215 : 6; 00216 uint8_t dc_sg : 8; 00217 }; 00218 }; 00219 }; 00220 00221 struct PWMCONF_t { 00222 constexpr static uint8_t address = 0x70; 00223 union { 00224 uint32_t sr : 22; 00225 struct { 00226 uint8_t pwm_ampl : 8, 00227 pwm_grad : 8, 00228 pwm_freq : 2; 00229 bool pwm_autoscale : 1, 00230 pwm_symmetric : 1; 00231 uint8_t freewheel : 2; 00232 }; 00233 }; 00234 }; 00235 00236 struct ENCM_CTRL_t { 00237 constexpr static uint8_t address = 0x72; 00238 union { 00239 uint8_t sr : 2; 00240 struct { 00241 bool inv : 1, 00242 maxspeed : 1; 00243 }; 00244 }; 00245 }; 00246 00247 #pragma pack(pop)
Generated on Wed Jul 13 2022 22:52:51 by
1.7.2