Library for Trinamic TMC2209 stepper modules to drive bipolar stepper motors. Ported and adapted from https://github.com/teemuatlut/TMCStepper

Dependents:   TMC2209-Test2

Committer:
charly
Date:
Thu Dec 02 20:29:39 2021 +0000
Revision:
2:b34e91b54373
Parent:
0:f4343071c8b1
Changes from Original Project for TMC2209 integrated

Who changed what in which revision?

UserRevisionLine numberNew contents of line
charly 0:f4343071c8b1 1 #include "TMCStepper.h"
charly 0:f4343071c8b1 2 #include "TMC_MACROS.h"
charly 0:f4343071c8b1 3
charly 0:f4343071c8b1 4 #define GET_REG(NS, SETTING) NS::DRV_STATUS_t r{0}; r.sr = DRV_STATUS(); return r.SETTING
charly 0:f4343071c8b1 5 /*
charly 0:f4343071c8b1 6 uint32_t TMC2130Stepper::DRV_STATUS() { return read(DRV_STATUS_t::address); }
charly 0:f4343071c8b1 7
charly 0:f4343071c8b1 8 uint16_t TMC2130Stepper::sg_result(){ GET_REG(TMC2130_n, sg_result); }
charly 0:f4343071c8b1 9 bool TMC2130Stepper::fsactive() { GET_REG(TMC2130_n, fsactive); }
charly 0:f4343071c8b1 10 uint8_t TMC2130Stepper::cs_actual() { GET_REG(TMC2130_n, cs_actual); }
charly 0:f4343071c8b1 11 bool TMC2130Stepper::stallguard() { GET_REG(TMC2130_n, stallGuard); }
charly 0:f4343071c8b1 12 bool TMC2130Stepper::ot() { GET_REG(TMC2130_n, ot); }
charly 0:f4343071c8b1 13 bool TMC2130Stepper::otpw() { GET_REG(TMC2130_n, otpw); }
charly 0:f4343071c8b1 14 bool TMC2130Stepper::s2ga() { GET_REG(TMC2130_n, s2ga); }
charly 0:f4343071c8b1 15 bool TMC2130Stepper::s2gb() { GET_REG(TMC2130_n, s2gb); }
charly 0:f4343071c8b1 16 bool TMC2130Stepper::ola() { GET_REG(TMC2130_n, ola); }
charly 0:f4343071c8b1 17 bool TMC2130Stepper::olb() { GET_REG(TMC2130_n, olb); }
charly 0:f4343071c8b1 18 bool TMC2130Stepper::stst() { GET_REG(TMC2130_n, stst); }
charly 0:f4343071c8b1 19 */
charly 0:f4343071c8b1 20 uint32_t TMC2208Stepper::DRV_STATUS() {
charly 0:f4343071c8b1 21 return read(TMC2208_n::DRV_STATUS_t::address);
charly 0:f4343071c8b1 22 }
charly 0:f4343071c8b1 23
charly 0:f4343071c8b1 24 bool TMC2208Stepper::otpw() { GET_REG(TMC2208_n, otpw); }
charly 0:f4343071c8b1 25 bool TMC2208Stepper::ot() { GET_REG(TMC2208_n, ot); }
charly 0:f4343071c8b1 26 bool TMC2208Stepper::s2ga() { GET_REG(TMC2208_n, s2ga); }
charly 0:f4343071c8b1 27 bool TMC2208Stepper::s2gb() { GET_REG(TMC2208_n, s2gb); }
charly 0:f4343071c8b1 28 bool TMC2208Stepper::s2vsa() { GET_REG(TMC2208_n, s2vsa); }
charly 0:f4343071c8b1 29 bool TMC2208Stepper::s2vsb() { GET_REG(TMC2208_n, s2vsb); }
charly 0:f4343071c8b1 30 bool TMC2208Stepper::ola() { GET_REG(TMC2208_n, ola); }
charly 0:f4343071c8b1 31 bool TMC2208Stepper::olb() { GET_REG(TMC2208_n, olb); }
charly 0:f4343071c8b1 32 bool TMC2208Stepper::t120() { GET_REG(TMC2208_n, t120); }
charly 0:f4343071c8b1 33 bool TMC2208Stepper::t143() { GET_REG(TMC2208_n, t143); }
charly 0:f4343071c8b1 34 bool TMC2208Stepper::t150() { GET_REG(TMC2208_n, t150); }
charly 0:f4343071c8b1 35 bool TMC2208Stepper::t157() { GET_REG(TMC2208_n, t157); }
charly 0:f4343071c8b1 36 uint16_t TMC2208Stepper::cs_actual() { GET_REG(TMC2208_n, cs_actual); }
charly 0:f4343071c8b1 37 bool TMC2208Stepper::stealth() { GET_REG(TMC2208_n, stealth); }
charly 0:f4343071c8b1 38 bool TMC2208Stepper::stst() { GET_REG(TMC2208_n, stst); }