186 #ifndef __AVR_ATmega328P__ 187 #error !!This library only supports the ATmega328p MCU!! 190 #include <inttypes.h> 225 #define INTFREQ 28200.0f 227 #define INTPERIOD 1000000.0/INTFREQ 229 #define INTPIDDELAYCONSTANT 0.028199994 240 #define ENCODERINTFREQ 1000.0 242 #define ENCODERSPEEDCONSTANT ENCODERINTFREQ/10.0/4096.0 244 #define ENCODERADDR 0x36 252 #define MAGNITUDE 0x1B 270 #define REPSTART 0x10 273 #define TXADDRACK 0x18 276 #define TXDATAACK 0x28 279 #define RXADDRACK 0x40 304 #define A 0.001295752996237 306 #define B 0.000237488365866 308 #define C 0.000000083423218 352 float getFloatValue(
void);
353 uint64_t getRawValue(
void);
354 void setValue(
float val);
355 float2 & operator=(
const float &value);
356 bool operator==(
const float2 &value);
357 bool operator!=(
const float2 &value);
358 bool operator>=(
const float2 &value);
359 bool operator<=(
const float2 &value);
360 bool operator<=(
const float &value);
361 bool operator<(
const float2 &value);
362 bool operator>(
const float2 &value);
363 float2 & operator*=(
const float2 &value);
364 float2 & operator-=(
const float2 &value);
365 float2 & operator+=(
const float2 &value);
366 float2 & operator+=(
const float &value);
367 float2 & operator/=(
const float2 &value);
368 const float2 operator+(
const float2 &value);
369 const float2 operator-(
const float2 &value);
370 const float2 operator*(
const float2 &value);
371 const float2 operator/(
const float2 &value);
477 float getAngle(
void);
489 float getSpeed(
void);
498 uint16_t getStrength(
void);
509 uint8_t getAgc(
void);
521 uint8_t detectMagnet(
void);
539 float getAngleMoved(
void);
549 void setup(uint8_t mode);
720 volatile uint32_t speedValue[2];
758 void startTimer(
void);
769 void stopTimer(
void);
781 void enableMotor(
void);
791 void disableMotor(
void);
797 void pidDropIn(
void);
825 uStepper(
float accel,
float vel);
850 void setMaxAcceleration(
float accel);
861 float getMaxAcceleration(
void);
874 void setMaxVelocity(
float vel);
886 float getMaxVelocity(
void);
901 void runContinous(
bool dir);
921 void moveSteps(uint32_t steps,
bool dir,
bool holdMode);
937 void hardStop(
bool holdMode);
954 void softStop(
bool holdMode);
990 void setup( uint8_t mode =
NORMAL,
991 uint8_t microStepping =
SIXTEEN,
992 float faultTolerance = 10.0,
993 float faultHysteresis = 5.0,
996 float dterm = 0.006);
1008 bool getCurrentDirection(
void);
1020 bool getMotorState(
void);
1044 int32_t getStepsSinceReset(
void);
1057 void pwmD8(
double current);
1068 void setCurrent(
double duty);
1078 void pwmD8(
int mode);
1091 void pwmD3(
double duty);
1102 void pwmD3(
int mode);
1113 void updateSetPoint(
float setPoint);
1152 bool cmd(uint8_t cmd);
1184 bool readByte(
bool ack, uint8_t *data);
1207 bool read(uint8_t slaveAddr, uint8_t regAddr, uint8_t numOfBytes, uint8_t *data);
1226 bool start(uint8_t addr,
bool RW);
1245 bool restart(uint8_t addr,
bool RW);
1257 bool writeByte(uint8_t data);
1279 bool write(uint8_t slaveAddr, uint8_t regAddr, uint8_t numOfBytes, uint8_t *data);
1301 uint8_t getStatus(
void);
void interrupt0(void)
Used by dropin feature to take in step pulses.
Prototype of class for the temperature sensor.
void TIMER1_COMPA_vect(void) __attribute__((signal
Measures angle and speed of motor.
volatile uint16_t counter
Prototype of class for accessing all features of the uStepper in a single object. ...
void TIMER2_COMPA_vect(void) __attribute__((signal
Used to apply step pulses to the motor.
float getTemp(void)
Request a reading of current temperature.
volatile int32_t stepsSinceReset
volatile int32_t angleMoved
volatile uint16_t oldAngle
Prototype of class for accessing the TWI (I2C) interface of the AVR (master mode only).
Prototype of class for the AS5600 encoder.
volatile float hysteresis
volatile int16_t revolutions
void interrupt1(void)
Used by dropin feature to take in enable signal.
Function prototypes and definitions for the uStepper Servo library.
uStepperTemp(void)
Constructor.
volatile float stepConversion
uint32_t initialDecelSteps