195 #ifndef __AVR_ATmega328P__ 196 #error !!This library only supports the ATmega328p MCU!! 199 #include <inttypes.h> 201 #include <avr/delay.h> 235 #define INTFREQ 28200.0f 237 #define INTPERIOD 1000000.0/INTFREQ 239 #define INTPIDDELAYCONSTANT 0.028199994 250 #define ENCODERINTFREQ 1000.0 252 #define ENCODERSPEEDCONSTANT ENCODERINTFREQ/10.0/4096.0 254 #define ENCODERADDR 0x36 262 #define MAGNITUDE 0x1B 280 #define REPSTART 0x10 283 #define TXADDRACK 0x18 286 #define TXDATAACK 0x28 289 #define RXADDRACK 0x40 314 #define A 0.001295752996237 316 #define B 0.000237488365866 318 #define C 0.000000083423218 362 float getFloatValue(
void);
363 uint64_t getRawValue(
void);
364 void setValue(
float val);
365 float2 & operator=(
const float &value);
366 bool operator==(
const float2 &value);
367 bool operator!=(
const float2 &value);
368 bool operator>=(
const float2 &value);
369 bool operator<=(
const float2 &value);
370 bool operator<=(
const float &value);
371 bool operator<(
const float2 &value);
372 bool operator>(
const float2 &value);
376 float2 & operator+=(
const float &value);
487 float getAngle(
void);
499 float getSpeed(
void);
508 uint16_t getStrength(
void);
519 uint8_t getAgc(
void);
531 uint8_t detectMagnet(
void);
549 float getAngleMoved(
void);
559 void setup(uint8_t mode);
730 volatile uint32_t speedValue[2];
768 void startTimer(
void);
779 void stopTimer(
void);
791 void enableMotor(
void);
801 void disableMotor(
void);
807 void pidDropIn(
void);
860 void setMaxAcceleration(
float accel);
871 float getMaxAcceleration(
void);
884 void setMaxVelocity(
float vel);
896 float getMaxVelocity(
void);
911 void runContinous(
bool dir);
931 void moveSteps(int32_t steps,
bool dir,
bool holdMode);
947 void hardStop(
bool holdMode);
964 void softStop(
bool holdMode);
1003 void setup( uint8_t mode =
NORMAL,
1004 uint8_t microStepping =
SIXTEEN,
1005 float faultTolerance = 10.0,
1006 float faultHysteresis = 5.0,
1009 float dterm = 0.006,
1010 bool setHome =
true);
1022 bool getCurrentDirection(
void);
1034 bool getMotorState(
void);
1058 int32_t getStepsSinceReset(
void);
1071 void pwmD8(
double duty);
1082 void setCurrent(
double current);
1092 void pwmD8(
int mode);
1105 void pwmD3(
double duty);
1116 void pwmD3(
int mode);
1127 void updateSetPoint(
float setPoint);
1139 void moveToAngle(
float angle,
bool holdMode);
1150 void moveAngle(
float angle,
bool holdMode);
1189 bool cmd(uint8_t cmd);
1221 bool readByte(
bool ack, uint8_t *data);
1244 bool read(uint8_t slaveAddr, uint8_t regAddr, uint8_t numOfBytes, uint8_t *data);
1263 bool start(uint8_t addr,
bool RW);
1282 bool restart(uint8_t addr,
bool RW);
1294 bool writeByte(uint8_t data);
1316 bool write(uint8_t slaveAddr, uint8_t regAddr, uint8_t numOfBytes, uint8_t *data);
1338 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
friend void TIMER2_COMPA_vect(void) __attribute__((signal
Used to apply step pulses to the motor.
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.
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
void setHome(void)
Define new reference(home) position.
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.
volatile float stepConversion
uint32_t initialDecelSteps