Function prototypes and definitions for the uStepper library. More...
#include <inttypes.h>
#include <avr/io.h>
Go to the source code of this file.
Classes | |
class | uStepperTemp |
Prototype of class for the temperature sensor. More... | |
class | uStepperEncoder |
Prototype of class for the AS5600 encoder. More... | |
class | uStepper |
Prototype of class for accessing all features of the uStepper in a single object. More... | |
class | i2cMaster |
Prototype of class for accessing the TWI (I2C) interface of the AVR (master mode only). More... | |
Macros | |
#define | STOP 1 |
#define | ACCEL 2 |
#define | CRUISE 4 |
#define | DECEL 8 |
#define | INITDECEL 16 |
#define | INTFREQ 32830.0f |
#define | CW 0 |
#define | CCW 1 |
#define | HARD 1 |
#define | SOFT 0 |
#define | ENCODERADDR 0x36 |
#define | ANGLE 0x0E |
#define | STATUS 0x0B |
#define | AGC 0x1A |
#define | MAGNITUDE 0x1B |
#define | ENCODERINTFREQ 244.3 |
#define | ENCODERSPEEDCONSTANT ENCODERINTFREQ/360.0 |
#define | R 4700.0 |
#define | I2CFREE 0 |
#define | READ 1 |
#define | WRITE 0 |
#define | START 0x08 |
#define | REPSTART 0x10 |
#define | TXADDRACK 0x18 |
#define | TXDATAACK 0x28 |
#define | RXADDRACK 0x40 |
#define | ACK 1 |
#define | NACK 0 |
#define | A 0.001295752996237 |
#define | B 0.000237488365866 |
#define | C 0.000000083423218 |
Functions | |
void | TIMER2_COMPA_vect (void) __attribute__((signal |
void | TIMER1_COMPA_vect (void) __attribute__((signal)) |
Variables | |
void | naked |
i2cMaster | I2C |
Function prototypes and definitions for the uStepper library.
This file contains class and function prototypes for the library, as well as necessary constants and global variables.
Definition in file uStepper.h.
#define A 0.001295752996237 |
Coefficients needed by the Steinhart-hart equation in order to find the temperature of the NTC (and hereby the temperature of the motor driver) from the current resistance of the NTC resistor. The coefficients are calculated for the following 3 operating points:
A: T = 5 degree Celsius
B: T = 50 degree Celsius
C: T = 105 degree Celsius
The Steinhart-Hart equation is described at the following link:
https://en.wikipedia.org/wiki/Steinhart%E2%80%93Hart_equation#Developers_of_the_equation
Definition at line 203 of file uStepper.h.
#define ACCEL 2 |
Value to put in state variable in order to indicate that the motor should be accelerating
Definition at line 145 of file uStepper.h.
#define ACK 1 |
value to indicate ACK for i2c transmission
Definition at line 183 of file uStepper.h.
#define AGC 0x1A |
Address of the register, in the encoder chip, containing information about the current gain value used in the encoder chip. This value should preferably be around 127 (Ideal case!)
Definition at line 159 of file uStepper.h.
#define ANGLE 0x0E |
Address of the register, in the encoder chip, containing the 8 least significant bits of the stepper shaft angle
Definition at line 157 of file uStepper.h.
#define B 0.000237488365866 |
See description of A
Definition at line 204 of file uStepper.h.
#define C 0.000000083423218 |
See description of A
Definition at line 205 of file uStepper.h.
#define CCW 1 |
Value to put in direction variable in order for the stepper to turn counterclockwise
Definition at line 151 of file uStepper.h.
#define CRUISE 4 |
Value to put in state variable in order to indicate that the motor should be decelerating
Definition at line 146 of file uStepper.h.
#define CW 0 |
Value to put in direction variable in order for the stepper to turn clockwise
Definition at line 150 of file uStepper.h.
#define DECEL 8 |
Value to put in state variable in order to indicate that the motor should be cruising at constant speed with no acceleration
Definition at line 147 of file uStepper.h.
#define ENCODERADDR 0x36 |
I2C address of the encoder chip
Definition at line 155 of file uStepper.h.
#define ENCODERINTFREQ 244.3 |
Frequency at which the encoder is sampled, for keeping track of angle moved and current speed
Definition at line 162 of file uStepper.h.
#define ENCODERSPEEDCONSTANT ENCODERINTFREQ/360.0 |
Constant to convert angle difference between two interrupts to speed in revolutions per second
Definition at line 163 of file uStepper.h.
#define HARD 1 |
Value to put in hold variable in order for the motor to block when it is not running
Definition at line 152 of file uStepper.h.
#define I2CFREE 0 |
I2C bus is not currently in use
Definition at line 167 of file uStepper.h.
#define INITDECEL 16 |
Value to put in state variable in order to indicate that the motor should be decelerating to full stop before changing direction
Definition at line 148 of file uStepper.h.
#define INTFREQ 32830.0f |
Frequency of interrupt routine, in which the delays for the stepper algorithm is calculated
Definition at line 149 of file uStepper.h.
#define MAGNITUDE 0x1B |
Address of the register, in the encoder chip, containing the 8 least significant bits of magnetic field strength measured by the encoder chip
Definition at line 160 of file uStepper.h.
#define NACK 0 |
value to indicate NACK for i2c transmission
Definition at line 185 of file uStepper.h.
#define R 4700.0 |
The NTC resistor used for measuring temperature, is placed in series with a 4.7 kohm resistor. This is used to calculate the temperature
Definition at line 165 of file uStepper.h.
#define READ 1 |
Value for RW bit in address field, to request a read
Definition at line 169 of file uStepper.h.
#define REPSTART 0x10 |
repeated start condition transmitted
Definition at line 175 of file uStepper.h.
#define RXADDRACK 0x40 |
slave address plus read bit transmitted, ACK received
Definition at line 181 of file uStepper.h.
#define SOFT 0 |
Value to put in hold variable in order for the motor to not block when it is not running
Definition at line 153 of file uStepper.h.
#define START 0x08 |
start condition transmitted
Definition at line 173 of file uStepper.h.
#define STATUS 0x0B |
Address of the register, in the encoder chip, containing information about whether a magnet has been detected or not
Definition at line 158 of file uStepper.h.
#define STOP 1 |
Value to put in state variable in order to indicate that the motor should not be running
Definition at line 144 of file uStepper.h.
#define TXADDRACK 0x18 |
slave address plus write bit transmitted, ACK received
Definition at line 177 of file uStepper.h.
#define TXDATAACK 0x28 |
data transmitted, ACK received
Definition at line 179 of file uStepper.h.
#define WRITE 0 |
Value for RW bit in address field, to request a write
Definition at line 171 of file uStepper.h.
i2cMaster I2C |
Global definition of I2C object for use in arduino sketch
Definition at line 82 of file uStepper.cpp.