Karl Zweimüller / TMCStepper

Dependents:   TMC2209-Test2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TMC2208_bitfields.h Source File

TMC2208_bitfields.h

00001 #pragma once
00002 #pragma pack(push, 1)
00003 
00004 namespace TMC2208_n {
00005   struct GCONF_t {
00006     constexpr static uint8_t address = 0x00;
00007     union {
00008       uint16_t sr : 10;
00009       struct {
00010         bool  i_scale_analog : 1,
00011               internal_rsense : 1,
00012               en_spreadcycle : 1,
00013               shaft : 1,
00014               index_otpw : 1,
00015               index_step : 1,
00016               pdn_disable : 1,
00017               mstep_reg_select : 1,
00018               multistep_filt : 1,
00019               test_mode : 1;
00020       };
00021     };
00022   };
00023 }
00024 
00025 namespace TMC2208_n {
00026   struct IOIN_t {
00027     constexpr static uint8_t address = 0x06;
00028     union {
00029       uint32_t sr;
00030       struct {
00031         bool  enn : 1,
00032               : 1,
00033               ms1 : 1,
00034               ms2 : 1,
00035               diag : 1,
00036               : 1,
00037               pdn_uart : 1,
00038               step : 1,
00039               sel_a : 1,
00040               dir : 1;
00041         uint16_t : 14;
00042         uint8_t version : 8;
00043       };
00044     };
00045   };
00046 }
00047 
00048 namespace TMC2224_n {
00049   struct IOIN_t {
00050     constexpr static uint8_t address = 0x06;
00051     union {
00052       uint32_t sr;
00053       struct {
00054         bool  : 1,
00055               pdn_uart : 1,
00056               spread : 1,
00057               dir : 1,
00058               enn : 1,
00059               step : 1,
00060               ms1 : 1,
00061               ms2 : 1,
00062               sel_a : 1;
00063         uint16_t : 15;
00064         uint8_t version : 8;
00065       };
00066     };
00067   };
00068 }
00069 
00070 struct FACTORY_CONF_t {
00071   constexpr static uint8_t address = 0x07;
00072   union {
00073     uint16_t sr;
00074     struct {
00075         uint8_t fclktrim : 5,
00076                          : 3,
00077                 ottrim : 2;
00078     };
00079   };
00080 };
00081 
00082 namespace TMC2208_n {
00083   struct VACTUAL_t {
00084     constexpr static uint8_t address = 0x22;
00085     uint32_t sr;
00086   };
00087 }
00088 
00089 struct MSCURACT_t {
00090   constexpr static uint8_t address = 0x6B;
00091   union {
00092     uint32_t sr : 25;
00093     struct {
00094       int16_t cur_a : 9,
00095                     : 7,
00096               cur_b : 9;
00097     };
00098   };
00099 };
00100 
00101 namespace TMC2208_n {
00102   struct CHOPCONF_t {
00103     constexpr static uint8_t address = 0x6C;
00104     union {
00105       uint32_t sr;
00106       struct {
00107         uint8_t toff : 4,
00108                 hstrt : 3,
00109                 hend : 4,
00110                      : 4,
00111                 tbl : 2;
00112         bool    vsense : 1;
00113         uint8_t : 6,
00114                 mres : 4;
00115         bool    intpol : 1,
00116                 dedge : 1,
00117                 diss2g : 1,
00118                 diss2vs : 1;
00119       };
00120     };
00121   };
00122 
00123   struct PWMCONF_t {
00124     constexpr static uint8_t address = 0x70;
00125     union {
00126       uint32_t sr;
00127       struct {
00128         uint8_t pwm_ofs : 8,
00129                 pwm_grad : 8,
00130                 pwm_freq : 2;
00131         bool pwm_autoscale : 1,
00132              pwm_autograd : 1;
00133         uint8_t freewheel : 2,
00134                           : 2,
00135                 pwm_reg : 4,
00136                 pwm_lim : 4;
00137       };
00138     };
00139   };
00140 
00141   struct DRV_STATUS_t {
00142     constexpr static uint8_t address = 0x6F;
00143     union {
00144       uint32_t sr;
00145       struct {
00146         bool otpw : 1,
00147              ot : 1,
00148              s2ga : 1,
00149              s2gb : 1,
00150              s2vsa : 1,
00151              s2vsb : 1,
00152              ola : 1,
00153              olb : 1,
00154              t120 : 1,
00155              t143 : 1,
00156              t150 : 1,
00157              t157 : 1;
00158         uint8_t : 4,
00159                 cs_actual : 5,
00160                 : 3,
00161                 : 6;
00162         bool stealth : 1,
00163              stst : 1;
00164       };
00165     };
00166   };
00167 
00168   struct PWM_SCALE_t {
00169     constexpr static uint8_t address = 0x71;
00170     union {
00171       uint32_t sr;
00172       struct {
00173         uint8_t pwm_scale_sum : 8,
00174                 : 8;
00175         int16_t pwm_scale_auto : 9;
00176       };
00177     };
00178   };
00179 }
00180 
00181 #pragma pack(pop)