178 #ifndef __AVR_ATmega328P__ 179 #error !!This library only supports the ATmega328p MCU!! 182 #include <inttypes.h> 217 #define INTFREQ 28200.0f 219 #define INTPERIOD 1000000.0/INTFREQ 221 #define INTPIDDELAYCONSTANT 0.028199994 232 #define ENCODERINTFREQ 1000.0 234 #define ENCODERSPEEDCONSTANT ENCODERINTFREQ/10.0/4096.0 236 #define ENCODERADDR 0x36 244 #define MAGNITUDE 0x1B 262 #define REPSTART 0x10 265 #define TXADDRACK 0x18 268 #define TXDATAACK 0x28 271 #define RXADDRACK 0x40 296 #define A 0.001295752996237 298 #define B 0.000237488365866 300 #define C 0.000000083423218 344 float getFloatValue(
void);
345 uint64_t getRawValue(
void);
346 void setValue(
float val);
347 float2 & operator=(
const float &value);
348 bool operator==(
const float2 &value);
349 bool operator!=(
const float2 &value);
350 bool operator>=(
const float2 &value);
351 bool operator<=(
const float2 &value);
352 bool operator<=(
const float &value);
353 bool operator<(
const float2 &value);
354 bool operator>(
const float2 &value);
355 float2 & operator*=(
const float2 &value);
356 float2 & operator-=(
const float2 &value);
357 float2 & operator+=(
const float2 &value);
358 float2 & operator+=(
const float &value);
359 float2 & operator/=(
const float2 &value);
360 const float2 operator+(
const float2 &value);
361 const float2 operator-(
const float2 &value);
362 const float2 operator*(
const float2 &value);
363 const float2 operator/(
const float2 &value);
469 float getAngle(
void);
481 float getSpeed(
void);
490 uint16_t getStrength(
void);
501 uint8_t getAgc(
void);
513 uint8_t detectMagnet(
void);
531 float getAngleMoved(
void);
541 void setup(uint8_t mode);
712 volatile uint32_t speedValue[2];
749 void startTimer(
void);
760 void stopTimer(
void);
772 void enableMotor(
void);
782 void disableMotor(
void);
788 void pidDropIn(
void);
816 uStepper(
float accel,
float vel);
841 void setMaxAcceleration(
float accel);
852 float getMaxAcceleration(
void);
865 void setMaxVelocity(
float vel);
877 float getMaxVelocity(
void);
892 void runContinous(
bool dir);
912 void moveSteps(uint32_t steps,
bool dir,
bool holdMode);
928 void hardStop(
bool holdMode);
945 void softStop(
bool holdMode);
981 void setup( uint8_t mode =
NORMAL,
982 uint8_t microStepping =
SIXTEEN,
983 float faultTolerance = 10.0,
984 float faultHysteresis = 5.0,
987 float dterm = 0.006);
999 bool getCurrentDirection(
void);
1011 bool getMotorState(
void);
1035 int32_t getStepsSinceReset(
void);
1048 void pwmD8(
double duty);
1058 void pwmD8(
int mode);
1071 void pwmD3(
double duty);
1082 void pwmD3(
int mode);
1093 void updateSetPoint(
float setPoint);
1132 bool cmd(uint8_t cmd);
1164 bool readByte(
bool ack, uint8_t *data);
1187 bool read(uint8_t slaveAddr, uint8_t regAddr, uint8_t numOfBytes, uint8_t *data);
1206 bool start(uint8_t addr,
bool RW);
1225 bool restart(uint8_t addr,
bool RW);
1237 bool writeByte(uint8_t data);
1259 bool write(uint8_t slaveAddr, uint8_t regAddr, uint8_t numOfBytes, uint8_t *data);
1281 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