TMCStepper
DRVCTRL.cpp
Go to the documentation of this file.
1
#include "
TMCStepper.h
"
2
#include "
TMC_MACROS.h
"
3
4
#define SET_REG0(SETTING) DRVCTRL_0_register.SETTING = B; DRVCTRL(DRVCTRL_0_register.sr)
5
#define SET_REG1(SETTING) DRVCTRL_1_register.SETTING = B; DRVCTRL(DRVCTRL_1_register.sr)
6
#define GET_REG0(SETTING) return DRVCTRL_0_register.SETTING
7
#define GET_REG1(SETTING) return DRVCTRL_1_register.SETTING
8
9
uint32_t
TMC2660Stepper::DRVCTRL
() {
10
if
(
sdoff
() == 1)
return
DRVCTRL_1_register.sr;
11
else
return
DRVCTRL_0_register.sr;
12
}
13
void
TMC2660Stepper::DRVCTRL
(uint32_t data) {
14
if
(
sdoff
() == 1) {
15
DRVCTRL_1_register.sr = data;
16
write
(DRVCTRL_1_register.address, DRVCTRL_1_register.sr);
17
}
else
{
18
DRVCTRL_0_register.sr = data;
19
write
(DRVCTRL_0_register.address, DRVCTRL_0_register.sr);
20
}
21
}
22
23
// DRVCTRL (SPI)
24
void
TMC2660Stepper::pha
(
bool
B) {
if
(
sdoff
() == 0)
return
;
SET_REG1
(
pha
); }
25
void
TMC2660Stepper::ca
(uint8_t B) {
if
(
sdoff
() == 0)
return
;
SET_REG1
(
ca
); }
26
void
TMC2660Stepper::phb
(
bool
B) {
if
(
sdoff
() == 0)
return
;
SET_REG1
(
phb
); }
27
void
TMC2660Stepper::cb
(uint8_t B) {
if
(
sdoff
() == 0)
return
;
SET_REG1
(
cb
); }
28
29
bool
TMC2660Stepper::pha
() {
if
(
sdoff
() == 0)
sdoff
(1);
GET_REG1
(
pha
); }
30
uint8_t
TMC2660Stepper::ca
() {
if
(
sdoff
() == 0)
sdoff
(1);
GET_REG1
(
ca
); }
31
bool
TMC2660Stepper::phb
() {
if
(
sdoff
() == 0)
sdoff
(1);
GET_REG1
(
phb
); }
32
uint8_t
TMC2660Stepper::cb
() {
if
(
sdoff
() == 0)
sdoff
(1);
GET_REG1
(
cb
); }
33
34
// DRVCTRL (STEP/DIR)
35
void
TMC2660Stepper::intpol
(
bool
B) {
if
(
sdoff
())
return
;
SET_REG0
(
intpol
); }
36
void
TMC2660Stepper::dedge
(
bool
B) {
if
(
sdoff
())
return
;
SET_REG0
(
dedge
); }
37
void
TMC2660Stepper::mres
(uint8_t B){
if
(
sdoff
())
return
;
SET_REG0
(
mres
); }
38
39
bool
TMC2660Stepper::intpol
() {
if
(
sdoff
())
sdoff
(0);
GET_REG0
(
intpol
); }
40
bool
TMC2660Stepper::dedge
() {
if
(
sdoff
())
sdoff
(0);
GET_REG0
(
dedge
); }
41
uint8_t
TMC2660Stepper::mres
(){
if
(
sdoff
())
sdoff
(0);
GET_REG0
(
mres
); }
TMC2660Stepper::dedge
bool dedge()
Definition:
DRVCTRL.cpp:40
TMC2660Stepper::DRVCTRL
uint32_t DRVCTRL()
Definition:
DRVCTRL.cpp:9
SET_REG1
#define SET_REG1(SETTING)
Definition:
DRVCTRL.cpp:5
TMCStepper.h
TMC2660Stepper::intpol
bool intpol()
Definition:
DRVCTRL.cpp:39
TMC_MACROS.h
GET_REG1
#define GET_REG1(SETTING)
Definition:
DRVCTRL.cpp:7
TMC2660Stepper::mres
uint8_t mres()
Definition:
DRVCTRL.cpp:41
TMC2660Stepper::ca
uint8_t ca()
Definition:
DRVCTRL.cpp:30
TMC2660Stepper::cb
uint8_t cb()
Definition:
DRVCTRL.cpp:32
GET_REG0
#define GET_REG0(SETTING)
Definition:
DRVCTRL.cpp:6
TMC2660Stepper::sdoff
bool sdoff()
Definition:
DRVCONF.cpp:27
TMC2660Stepper::write
void write(uint8_t addressByte, uint32_t config)
Definition:
TMC2660Stepper.cpp:54
TMC2660Stepper::phb
bool phb()
Definition:
DRVCTRL.cpp:31
SET_REG0
#define SET_REG0(SETTING)
Definition:
DRVCTRL.cpp:4
TMC2660Stepper::pha
bool pha()
Definition:
DRVCTRL.cpp:29
src
source
DRVCTRL.cpp
Generated by
1.8.17