182 #ifndef __AVR_ATmega328P__ 183 #error !!This library only supports the ATmega328p MCU!! 186 #include <inttypes.h> 221 #define INTFREQ 28200.0f 223 #define INTPERIOD 1000000.0/INTFREQ 225 #define INTPIDDELAYCONSTANT 0.028199994 236 #define ENCODERINTFREQ 1000.0 238 #define ENCODERSPEEDCONSTANT ENCODERINTFREQ/10.0/4096.0 240 #define ENCODERADDR 0x36 248 #define MAGNITUDE 0x1B 266 #define REPSTART 0x10 269 #define TXADDRACK 0x18 272 #define TXDATAACK 0x28 275 #define RXADDRACK 0x40 300 #define A 0.001295752996237 302 #define B 0.000237488365866 304 #define C 0.000000083423218 348 float getFloatValue(
void);
349 uint64_t getRawValue(
void);
350 void setValue(
float val);
351 float2 & operator=(
const float &value);
352 bool operator==(
const float2 &value);
353 bool operator!=(
const float2 &value);
354 bool operator>=(
const float2 &value);
355 bool operator<=(
const float2 &value);
356 bool operator<=(
const float &value);
357 bool operator<(
const float2 &value);
358 bool operator>(
const float2 &value);
359 float2 & operator*=(
const float2 &value);
360 float2 & operator-=(
const float2 &value);
361 float2 & operator+=(
const float2 &value);
362 float2 & operator+=(
const float &value);
363 float2 & operator/=(
const float2 &value);
364 const float2 operator+(
const float2 &value);
365 const float2 operator-(
const float2 &value);
366 const float2 operator*(
const float2 &value);
367 const float2 operator/(
const float2 &value);
473 float getAngle(
void);
485 float getSpeed(
void);
494 uint16_t getStrength(
void);
505 uint8_t getAgc(
void);
517 uint8_t detectMagnet(
void);
535 float getAngleMoved(
void);
545 void setup(uint8_t mode);
716 volatile uint32_t speedValue[2];
754 void startTimer(
void);
765 void stopTimer(
void);
777 void enableMotor(
void);
787 void disableMotor(
void);
793 void pidDropIn(
void);
821 uStepper(
float accel,
float vel);
846 void setMaxAcceleration(
float accel);
857 float getMaxAcceleration(
void);
870 void setMaxVelocity(
float vel);
882 float getMaxVelocity(
void);
897 void runContinous(
bool dir);
917 void moveSteps(uint32_t steps,
bool dir,
bool holdMode);
933 void hardStop(
bool holdMode);
950 void softStop(
bool holdMode);
986 void setup( uint8_t mode =
NORMAL,
987 uint8_t microStepping =
SIXTEEN,
988 float faultTolerance = 10.0,
989 float faultHysteresis = 5.0,
992 float dterm = 0.006);
1004 bool getCurrentDirection(
void);
1016 bool getMotorState(
void);
1040 int32_t getStepsSinceReset(
void);
1053 void pwmD8(
double duty);
1063 void pwmD8(
int mode);
1076 void pwmD3(
double duty);
1087 void pwmD3(
int mode);
1098 void updateSetPoint(
float setPoint);
1137 bool cmd(uint8_t cmd);
1169 bool readByte(
bool ack, uint8_t *data);
1192 bool read(uint8_t slaveAddr, uint8_t regAddr, uint8_t numOfBytes, uint8_t *data);
1211 bool start(uint8_t addr,
bool RW);
1230 bool restart(uint8_t addr,
bool RW);
1242 bool writeByte(uint8_t data);
1264 bool write(uint8_t slaveAddr, uint8_t regAddr, uint8_t numOfBytes, uint8_t *data);
1286 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