TMCStepper
PWMCONF.cpp
Go to the documentation of this file.
1 #include "TMCStepper.h"
2 #include "TMC_MACROS.h"
3 
4 #define SET_REG(SETTING) PWMCONF_register.SETTING = B; write(PWMCONF_register.address, PWMCONF_register.sr)
5 #define GET_REG(SETTING) return PWMCONF_register.SETTING
6 
7 // PWMCONF
8 uint32_t TMC2130Stepper::PWMCONF() { return PWMCONF_register.sr; }
9 void TMC2130Stepper::PWMCONF(uint32_t input) {
10  PWMCONF_register.sr = input;
11  write(PWMCONF_register.address, PWMCONF_register.sr);
12 }
13 
14 void TMC2130Stepper::pwm_ampl( uint8_t B ) { SET_REG(pwm_ampl); }
15 void TMC2130Stepper::pwm_grad( uint8_t B ) { SET_REG(pwm_grad); }
16 void TMC2130Stepper::pwm_freq( uint8_t B ) { SET_REG(pwm_freq); }
20 
27 
29  return PWMCONF_register.sr;
30 }
31 void TMC2160Stepper::PWMCONF(uint32_t input) {
32  PWMCONF_register.sr = input;
33  write(PWMCONF_register.address, PWMCONF_register.sr);
34 }
35 
36 void TMC2160Stepper::pwm_ofs ( uint8_t B ) { PWMCONF_register.pwm_ofs = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
37 void TMC2160Stepper::pwm_grad ( uint8_t B ) { PWMCONF_register.pwm_grad = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
38 void TMC2160Stepper::pwm_freq ( uint8_t B ) { PWMCONF_register.pwm_freq = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
39 void TMC2160Stepper::pwm_autoscale ( bool B ) { PWMCONF_register.pwm_autoscale = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
40 void TMC2160Stepper::pwm_autograd ( bool B ) { PWMCONF_register.pwm_autograd = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
41 void TMC2160Stepper::freewheel ( uint8_t B ) { PWMCONF_register.freewheel = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
42 void TMC2160Stepper::pwm_reg ( uint8_t B ) { PWMCONF_register.pwm_reg = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
43 void TMC2160Stepper::pwm_lim ( uint8_t B ) { PWMCONF_register.pwm_lim = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
44 
45 uint8_t TMC2160Stepper::pwm_ofs() { return PWMCONF_register.pwm_ofs; }
46 uint8_t TMC2160Stepper::pwm_grad() { return PWMCONF_register.pwm_grad; }
47 uint8_t TMC2160Stepper::pwm_freq() { return PWMCONF_register.pwm_freq; }
48 bool TMC2160Stepper::pwm_autoscale() { return PWMCONF_register.pwm_autoscale;}
49 bool TMC2160Stepper::pwm_autograd() { return PWMCONF_register.pwm_autograd; }
50 uint8_t TMC2160Stepper::freewheel() { return PWMCONF_register.freewheel; }
51 uint8_t TMC2160Stepper::pwm_reg() { return PWMCONF_register.pwm_reg; }
52 uint8_t TMC2160Stepper::pwm_lim() { return PWMCONF_register.pwm_lim; }
53 
55  return read(PWMCONF_register.address);
56 }
57 void TMC2208Stepper::PWMCONF(uint32_t input) {
58  PWMCONF_register.sr = input;
59  write(PWMCONF_register.address, PWMCONF_register.sr);
60 }
61 
62 void TMC2208Stepper::pwm_ofs ( uint8_t B ) { PWMCONF_register.pwm_ofs = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
63 void TMC2208Stepper::pwm_grad ( uint8_t B ) { PWMCONF_register.pwm_grad = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
64 void TMC2208Stepper::pwm_freq ( uint8_t B ) { PWMCONF_register.pwm_freq = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
65 void TMC2208Stepper::pwm_autoscale ( bool B ) { PWMCONF_register.pwm_autoscale = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
66 void TMC2208Stepper::pwm_autograd ( bool B ) { PWMCONF_register.pwm_autograd = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
67 void TMC2208Stepper::freewheel ( uint8_t B ) { PWMCONF_register.freewheel = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
68 void TMC2208Stepper::pwm_reg ( uint8_t B ) { PWMCONF_register.pwm_reg = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
69 void TMC2208Stepper::pwm_lim ( uint8_t B ) { PWMCONF_register.pwm_lim = B; write(PWMCONF_register.address, PWMCONF_register.sr); }
70 
71 uint8_t TMC2208Stepper::pwm_ofs() { TMC2208_n::PWMCONF_t r{0}; r.sr = PWMCONF(); return r.pwm_ofs; }
72 uint8_t TMC2208Stepper::pwm_grad() { TMC2208_n::PWMCONF_t r{0}; r.sr = PWMCONF(); return r.pwm_grad; }
73 uint8_t TMC2208Stepper::pwm_freq() { TMC2208_n::PWMCONF_t r{0}; r.sr = PWMCONF(); return r.pwm_freq; }
74 bool TMC2208Stepper::pwm_autoscale() { TMC2208_n::PWMCONF_t r{0}; r.sr = PWMCONF(); return r.pwm_autoscale; }
75 bool TMC2208Stepper::pwm_autograd() { TMC2208_n::PWMCONF_t r{0}; r.sr = PWMCONF(); return r.pwm_autograd; }
76 uint8_t TMC2208Stepper::freewheel() { TMC2208_n::PWMCONF_t r{0}; r.sr = PWMCONF(); return r.freewheel; }
77 uint8_t TMC2208Stepper::pwm_reg() { TMC2208_n::PWMCONF_t r{0}; r.sr = PWMCONF(); return r.pwm_reg; }
78 uint8_t TMC2208Stepper::pwm_lim() { TMC2208_n::PWMCONF_t r{0}; r.sr = PWMCONF(); return r.pwm_lim; }
TMC2208Stepper::PWMCONF
uint32_t PWMCONF()
Definition: PWMCONF.cpp:54
TMC2130Stepper::pwm_grad
uint8_t pwm_grad()
Definition: PWMCONF.cpp:22
TMC2130Stepper::pwm_symmetric
bool pwm_symmetric()
Definition: PWMCONF.cpp:25
TMC2208_n::PWMCONF_t::sr
uint32_t sr
Definition: TMC2208_bitfields.h:126
TMC2208Stepper::read
uint32_t read(uint8_t)
Definition: TMC2208Stepper.cpp:221
SET_REG
#define SET_REG(SETTING)
Definition: PWMCONF.cpp:4
GET_REG
#define GET_REG(SETTING)
Definition: PWMCONF.cpp:5
TMC2130Stepper::pwm_ampl
uint8_t pwm_ampl()
Definition: PWMCONF.cpp:21
TMCStepper.h
TMC2208Stepper::pwm_grad
uint8_t pwm_grad()
Definition: PWMCONF.cpp:72
TMC2160Stepper::pwm_grad
uint8_t pwm_grad()
Definition: PWMCONF.cpp:46
TMC2160Stepper::pwm_autoscale
bool pwm_autoscale()
Definition: PWMCONF.cpp:48
TMC2130Stepper::pwm_freq
uint8_t pwm_freq()
Definition: PWMCONF.cpp:23
TMC2160Stepper::PWMCONF
uint32_t PWMCONF()
Definition: PWMCONF.cpp:28
TMC2160Stepper::pwm_lim
uint8_t pwm_lim()
Definition: PWMCONF.cpp:52
TMC_MACROS.h
TMC2208_n::PWMCONF_t
Definition: TMC2208_bitfields.h:123
TMC2160Stepper::pwm_reg
uint8_t pwm_reg()
Definition: PWMCONF.cpp:51
TMC2208Stepper::pwm_freq
uint8_t pwm_freq()
Definition: PWMCONF.cpp:73
TMC2160Stepper::freewheel
uint8_t freewheel()
Definition: PWMCONF.cpp:50
TMC2208Stepper::freewheel
uint8_t freewheel()
Definition: PWMCONF.cpp:76
TMC2160Stepper::pwm_ofs
uint8_t pwm_ofs()
Definition: PWMCONF.cpp:45
TMC2208Stepper::pwm_autograd
bool pwm_autograd()
Definition: PWMCONF.cpp:75
TMC2208Stepper::write
void write(uint8_t, uint32_t)
Definition: TMC2208Stepper.cpp:118
TMC2160Stepper::pwm_freq
uint8_t pwm_freq()
Definition: PWMCONF.cpp:47
TMC2208Stepper::pwm_reg
uint8_t pwm_reg()
Definition: PWMCONF.cpp:77
TMC2130Stepper::PWMCONF
uint32_t PWMCONF()
Definition: PWMCONF.cpp:8
TMC2130Stepper::write
void write(uint8_t addressByte, uint32_t config)
Definition: TMC2130Stepper.cpp:148
TMC2208Stepper::pwm_ofs
uint8_t pwm_ofs()
Definition: PWMCONF.cpp:71
TMC2130Stepper::pwm_autoscale
bool pwm_autoscale()
Definition: PWMCONF.cpp:24
TMC2130Stepper::freewheel
uint8_t freewheel()
Definition: PWMCONF.cpp:26
TMC2208Stepper::pwm_autoscale
bool pwm_autoscale()
Definition: PWMCONF.cpp:74
TMC2160Stepper::pwm_autograd
bool pwm_autograd()
Definition: PWMCONF.cpp:49
TMC2208Stepper::pwm_lim
uint8_t pwm_lim()
Definition: PWMCONF.cpp:78