Karl Zweimüller / Mbed OS TMC2209-Test2

Dependencies:   TMCStepper mRotaryEncoder-os

Committer:
charly
Date:
Thu Feb 04 19:46:56 2021 +0000
Revision:
0:3f4cfbeda9d3
Working Version with TMC2209

Who changed what in which revision?

UserRevisionLine numberNew contents of line
charly 0:3f4cfbeda9d3 1 #include "TMCStepper.h"
charly 0:3f4cfbeda9d3 2 #include "TMC_MACROS.h"
charly 0:3f4cfbeda9d3 3
charly 0:3f4cfbeda9d3 4 #define SET_REG(SETTING) IHOLD_IRUN_register.SETTING = B; write(IHOLD_IRUN_register.address, IHOLD_IRUN_register.sr);
charly 0:3f4cfbeda9d3 5 #define GET_REG(SETTING) return IHOLD_IRUN_register.SETTING;
charly 0:3f4cfbeda9d3 6
charly 0:3f4cfbeda9d3 7 // IHOLD_IRUN
charly 0:3f4cfbeda9d3 8 uint32_t TMCStepper::IHOLD_IRUN() { return IHOLD_IRUN_register.sr; }
charly 0:3f4cfbeda9d3 9 void TMCStepper::IHOLD_IRUN(uint32_t input) {
charly 0:3f4cfbeda9d3 10 IHOLD_IRUN_register.sr = input;
charly 0:3f4cfbeda9d3 11 write(IHOLD_IRUN_register.address, IHOLD_IRUN_register.sr);
charly 0:3f4cfbeda9d3 12 }
charly 0:3f4cfbeda9d3 13
charly 0:3f4cfbeda9d3 14 void TMCStepper::ihold(uint8_t B) { SET_REG(ihold); }
charly 0:3f4cfbeda9d3 15 void TMCStepper::irun(uint8_t B) { SET_REG(irun); }
charly 0:3f4cfbeda9d3 16 void TMCStepper::iholddelay(uint8_t B) { SET_REG(iholddelay); }
charly 0:3f4cfbeda9d3 17
charly 0:3f4cfbeda9d3 18 uint8_t TMCStepper::ihold() { GET_REG(ihold); }
charly 0:3f4cfbeda9d3 19 uint8_t TMCStepper::irun() { GET_REG(irun); }
charly 0:3f4cfbeda9d3 20 uint8_t TMCStepper::iholddelay() { GET_REG(iholddelay); }