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.
Dependencies: TMCStepper mRotaryEncoder-os
source/TMC2209Stepper.cpp@1:60419aa0c030, 2021-02-04 (annotated)
- Committer:
- charly
- Date:
- Thu Feb 04 21:35:45 2021 +0000
- Revision:
- 1:60419aa0c030
- Parent:
- 0:3f4cfbeda9d3
Fast version with ca. 2,5rpm
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| charly | 0:3f4cfbeda9d3 | 1 | #include "TMCStepper.h" |
| charly | 0:3f4cfbeda9d3 | 2 | |
| charly | 0:3f4cfbeda9d3 | 3 | uint32_t TMC2209Stepper::IOIN() { |
| charly | 0:3f4cfbeda9d3 | 4 | return read(TMC2209_n::IOIN_t::address); |
| charly | 0:3f4cfbeda9d3 | 5 | } |
| charly | 0:3f4cfbeda9d3 | 6 | bool TMC2209Stepper::enn() { TMC2209_n::IOIN_t r{0}; r.sr = IOIN(); return r.enn; } |
| charly | 0:3f4cfbeda9d3 | 7 | bool TMC2209Stepper::ms1() { TMC2209_n::IOIN_t r{0}; r.sr = IOIN(); return r.ms1; } |
| charly | 0:3f4cfbeda9d3 | 8 | bool TMC2209Stepper::ms2() { TMC2209_n::IOIN_t r{0}; r.sr = IOIN(); return r.ms2; } |
| charly | 0:3f4cfbeda9d3 | 9 | bool TMC2209Stepper::diag() { TMC2209_n::IOIN_t r{0}; r.sr = IOIN(); return r.diag; } |
| charly | 0:3f4cfbeda9d3 | 10 | bool TMC2209Stepper::pdn_uart() { TMC2209_n::IOIN_t r{0}; r.sr = IOIN(); return r.pdn_uart; } |
| charly | 0:3f4cfbeda9d3 | 11 | bool TMC2209Stepper::step() { TMC2209_n::IOIN_t r{0}; r.sr = IOIN(); return r.step; } |
| charly | 0:3f4cfbeda9d3 | 12 | bool TMC2209Stepper::spread_en() { TMC2209_n::IOIN_t r{0}; r.sr = IOIN(); return r.spread_en;} |
| charly | 0:3f4cfbeda9d3 | 13 | bool TMC2209Stepper::dir() { TMC2209_n::IOIN_t r{0}; r.sr = IOIN(); return r.dir; } |
| charly | 0:3f4cfbeda9d3 | 14 | uint8_t TMC2209Stepper::version() { TMC2209_n::IOIN_t r{0}; r.sr = IOIN(); return r.version; } |
| charly | 0:3f4cfbeda9d3 | 15 | |
| charly | 0:3f4cfbeda9d3 | 16 | void TMC2209Stepper::push() { |
| charly | 0:3f4cfbeda9d3 | 17 | IHOLD_IRUN(IHOLD_IRUN_register.sr); |
| charly | 0:3f4cfbeda9d3 | 18 | TPOWERDOWN(TPOWERDOWN_register.sr); |
| charly | 0:3f4cfbeda9d3 | 19 | TPWMTHRS(TPWMTHRS_register.sr); |
| charly | 0:3f4cfbeda9d3 | 20 | GCONF(GCONF_register.sr); |
| charly | 0:3f4cfbeda9d3 | 21 | SLAVECONF(SLAVECONF_register.sr); |
| charly | 0:3f4cfbeda9d3 | 22 | VACTUAL(VACTUAL_register.sr); |
| charly | 0:3f4cfbeda9d3 | 23 | CHOPCONF(CHOPCONF_register.sr); |
| charly | 0:3f4cfbeda9d3 | 24 | PWMCONF(PWMCONF_register.sr); |
| charly | 0:3f4cfbeda9d3 | 25 | TCOOLTHRS(TCOOLTHRS_register.sr); |
| charly | 0:3f4cfbeda9d3 | 26 | } |
| charly | 0:3f4cfbeda9d3 | 27 | |
| charly | 0:3f4cfbeda9d3 | 28 | void TMC2209Stepper::SGTHRS(uint8_t input) { |
| charly | 0:3f4cfbeda9d3 | 29 | SGTHRS_register.sr = input; |
| charly | 0:3f4cfbeda9d3 | 30 | write(SGTHRS_register.address, SGTHRS_register.sr); |
| charly | 0:3f4cfbeda9d3 | 31 | } |
| charly | 0:3f4cfbeda9d3 | 32 | uint8_t TMC2209Stepper::SGTHRS() { |
| charly | 0:3f4cfbeda9d3 | 33 | return SGTHRS_register.sr; |
| charly | 0:3f4cfbeda9d3 | 34 | } |
| charly | 0:3f4cfbeda9d3 | 35 | |
| charly | 0:3f4cfbeda9d3 | 36 | // W: TCOOLTHRS |
| charly | 0:3f4cfbeda9d3 | 37 | uint32_t TMC2209Stepper::TCOOLTHRS() { return TCOOLTHRS_register.sr; } |
| charly | 0:3f4cfbeda9d3 | 38 | void TMC2209Stepper::TCOOLTHRS(uint32_t input) { |
| charly | 0:3f4cfbeda9d3 | 39 | TCOOLTHRS_register.sr = input; |
| charly | 0:3f4cfbeda9d3 | 40 | write(TCOOLTHRS_register.address, TCOOLTHRS_register.sr); |
| charly | 0:3f4cfbeda9d3 | 41 | } |
| charly | 0:3f4cfbeda9d3 | 42 | |
| charly | 0:3f4cfbeda9d3 | 43 | uint16_t TMC2209Stepper::SG_RESULT() { |
| charly | 0:3f4cfbeda9d3 | 44 | return read(TMC2209_n::SG_RESULT_t::address); |
| charly | 0:3f4cfbeda9d3 | 45 | } |