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