1#ifndef JMOTOR_DRIVER_TMC7300_H
2#define JMOTOR_DRIVER_TMC7300_H
35 JMotorDriverTMC7300(TMC7300IC& _ic,
boolean _channel,
boolean _checkDriver =
true,
byte _enablePin = -1)
48 if (((millis() +
ic.getChipAddress() * 125 + 500 *
channel) % 1000) <= 125) {
55 val = constrain(val, -1, 1);
56 uint32_t value = (uint32_t)(val * 255) & 0b111111111;
59 ic.writeField(TMC7300_PWM_A, value,
true);
61 ic.writeField(TMC7300_PWM_B, value,
true);
68 if (_enable ==
false) {
70 ic.writeField(TMC7300_PWM_A, 0);
72 ic.writeField(TMC7300_PWM_B, 0);
78 if (_enable ==
true &&
enabled ==
false) {
81 ic.writeField(TMC7300_PWM_A, 0);
83 ic.writeField(TMC7300_PWM_B, 0);
defines common interface for all types of JMotorDrivers
Definition JMotorDriver.h:10
control a motor connected to a TMC7300 motor driver chip
Definition JMotorDriverTMC7300.h:13
byte enablePin
Definition JMotorDriverTMC7300.h:19
bool set(float val)
set motor power
Definition JMotorDriverTMC7300.h:44
bool disable()
Definition JMotorDriverTMC7300.h:109
TMC7300IC & ic
reference to TMC7300IC class, use ic.writeField() to change advanced settings
Definition JMotorDriverTMC7300.h:25
unsigned long lastCheckedIC
Definition JMotorDriverTMC7300.h:18
bool setEnable(bool _enable)
use to enable or disable a motor, and sets up pin states
Definition JMotorDriverTMC7300.h:66
boolean enabled
Definition JMotorDriverTMC7300.h:15
boolean channel
Definition JMotorDriverTMC7300.h:16
float getMinRange()
low end of the range
Definition JMotorDriverTMC7300.h:101
bool enable()
Definition JMotorDriverTMC7300.h:105
JMotorDriverTMC7300(TMC7300IC &_ic, boolean _channel, boolean _checkDriver=true, byte _enablePin=-1)
control a motor connected to a TMC7300 dual motor driver chip
Definition JMotorDriverTMC7300.h:35
bool getEnable()
get the enable state of the driver
Definition JMotorDriverTMC7300.h:93
boolean checkDriver
Definition JMotorDriverTMC7300.h:17
float getMaxRange()
high end of the range
Definition JMotorDriverTMC7300.h:97