uStepper S-lite
|
Function prototypes and definitions for the uStepper S-lite library. More...
#include <EEPROM.h>
#include <inttypes.h>
#include <avr/io.h>
#include <util/delay.h>
#include <Arduino.h>
#include <uStepperServo.h>
#include "TMC2208.h"
#include "i2cMaster.h"
Go to the source code of this file.
Classes | |
union | floatBytes_t |
Union to easily split a float into its binary representation. More... | |
struct | dropinCliSettings_t |
Struct to store dropin settings. More... | |
class | uStepperEncoder |
Prototype of class for the AS5600 encoder. More... | |
class | uStepperSLite |
Prototype of class for accessing all features of the uStepper S-lite in a single object. More... | |
Macros | |
#define | STEPGENERATORFREQUENCY 100000.0 |
#define | FULL 1 |
#define | HALF 2 |
#define | QUARTER 4 |
#define | EIGHT 8 |
#define | SIXTEEN 16 |
#define | NORMAL 0 |
#define | PWM 1 |
#define | DROPIN 1 |
#define | PID 2 |
#define | STOP 1 |
#define | ACCEL 2 |
#define | CRUISE 4 |
#define | DECEL 8 |
#define | INITDECEL 16 |
#define | CW 0 |
#define | CCW 1 |
#define | HARD 1 |
#define | SOFT 0 |
#define | DELTAANGLETORPM ENCODERINTFREQ*(60.0/4095.0) |
#define | DELTAANGLETOSTEPSPERSECOND ENCODERINTFREQ*(3200.0/4095.0) |
#define | BRAKEON 1 |
#define | BRAKEOFF 0 |
#define | ENCODERINTFREQ 500.0 |
#define | ENCODERINTSAMPLETIME 1.0/ENCODERINTFREQ |
#define | ENCODERADDR 0x36 |
#define | ANGLE 0x0E |
#define | STATUS 0x0B |
#define | AGC 0x1A |
#define | MAGNITUDE 0x1B |
#define | PULSEFILTERKP 60.0 |
#define | PULSEFILTERKI 500.0*ENCODERINTSAMPLETIME |
#define | SPS 0 |
#define | RPM 1 |
I2C0 defines | |
Defines necessary to use I2C0 | |
#define | SDA SDA0 |
#define | SCL SCL0 |
#define | TWSTO TWSTO0 |
#define | TWDR TWDR0 |
#define | TWSTA TWSTA0 |
#define | TWINT TWINT0 |
#define | TWEA TWEA0 |
#define | TWEN TWEN0 |
#define | TWCR TWCR0 |
#define | TWIE TWIE0 |
#define | TWSR TWSR0 |
#define | TWPS0 TWPS00 |
#define | TWPS1 TWPS01 |
#define | TWBR TWBR0 |
Functions | |
void | TIMER1_COMPA_vect (void) __attribute__((signal |
Measures angle and speed of motor. More... | |
void | TIMER3_COMPA_vect (void) __attribute__((signal |
Handles accelerations. More... | |
void | INT0_vect (void) __attribute__((signal |
Used by dropin feature to take in step pulses. More... | |
void | INT1_vect (void) __attribute__((signal |
Used by dropin feature to take in enable signal. More... | |
Variables | |
void | used |
void | naked |
i2cMaster | I2C |
Function prototypes and definitions for the uStepper S-lite library.
This file contains class and function prototypes for the library, as well as necessary constants and global variables.
Definition in file uStepperSLite.h.
#define ACCEL 2 |
Value to put in state variable in order to indicate that the motor should be accelerating
Definition at line 213 of file uStepperSLite.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 247 of file uStepperSLite.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 243 of file uStepperSLite.h.
#define BRAKEOFF 0 |
Value to put in hold variable in order for the motor to not block when it is not running
Definition at line 235 of file uStepperSLite.h.
#define BRAKEON 1 |
Value to put in hold variable in order for the motor to block when it is not running
Definition at line 233 of file uStepperSLite.h.
#define CCW 1 |
Value to put in direction variable in order for the stepper to turn counterclockwise
Definition at line 223 of file uStepperSLite.h.
#define CRUISE 4 |
Value to put in state variable in order to indicate that the motor should be decelerating
Definition at line 215 of file uStepperSLite.h.
#define CW 0 |
Value to put in direction variable in order for the stepper to turn clockwise
Definition at line 221 of file uStepperSLite.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 217 of file uStepperSLite.h.
#define DELTAANGLETORPM ENCODERINTFREQ*(60.0/4095.0) |
Value to convert angle moved between samples to RPM.
Definition at line 229 of file uStepperSLite.h.
#define DELTAANGLETOSTEPSPERSECOND ENCODERINTFREQ*(3200.0/4095.0) |
Value to convert angle moved between samples to steps per second.
Definition at line 231 of file uStepperSLite.h.
#define DROPIN 1 |
Value defining dropin mode for 3d printer/CNC controller boards
Definition at line 207 of file uStepperSLite.h.
#define EIGHT 8 |
Eighth step definition
Definition at line 199 of file uStepperSLite.h.
#define ENCODERADDR 0x36 |
I2C address of the encoder chip
Definition at line 241 of file uStepperSLite.h.
#define ENCODERINTFREQ 500.0 |
Frequency at which the encoder is sampled, for keeping track of angle moved and current speed
Definition at line 237 of file uStepperSLite.h.
#define ENCODERINTSAMPLETIME 1.0/ENCODERINTFREQ |
Encoder Sample period, for keeping track of angle moved and current speed
Definition at line 239 of file uStepperSLite.h.
#define FULL 1 |
Full step definition
Definition at line 193 of file uStepperSLite.h.
#define HALF 2 |
Half step definition
Definition at line 195 of file uStepperSLite.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 225 of file uStepperSLite.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 219 of file uStepperSLite.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 249 of file uStepperSLite.h.
#define NORMAL 0 |
Value defining normal mode
Definition at line 203 of file uStepperSLite.h.
#define PID 2 |
Value defining PID mode for normal library functions
Definition at line 209 of file uStepperSLite.h.
#define PULSEFILTERKI 500.0*ENCODERINTSAMPLETIME |
I term in the PI filter estimating the step rate of incomming pulsetrain in DROPIN mode
Definition at line 253 of file uStepperSLite.h.
#define PULSEFILTERKP 60.0 |
P term in the PI filter estimating the step rate of incomming pulsetrain in DROPIN mode
Definition at line 251 of file uStepperSLite.h.
#define PWM 1 |
Value defining PWM mode of corresponding IO pin. Used to switch pin D3 and D8 between pwm or normal IO mode
Definition at line 205 of file uStepperSLite.h.
#define QUARTER 4 |
Quarter step definition
Definition at line 197 of file uStepperSLite.h.
#define RPM 1 |
Value defining return of speed in Revolutions Per Minute
Definition at line 257 of file uStepperSLite.h.
#define SIXTEEN 16 |
Sixteenth step definition
Definition at line 201 of file uStepperSLite.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 227 of file uStepperSLite.h.
#define SPS 0 |
Value defining return of speed in Steps Per Second
Definition at line 255 of file uStepperSLite.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 245 of file uStepperSLite.h.
#define STEPGENERATORFREQUENCY 100000.0 |
Step generator frequency set to 100 kHz
Definition at line 191 of file uStepperSLite.h.
#define STOP 1 |
Value to put in state variable in order to indicate that the motor should not be running
Definition at line 211 of file uStepperSLite.h.
void INT0_vect | ( | void | ) |
Used by dropin feature to take in step pulses.
This interrupt routine is used by the dropin feature to keep track of step and direction pulses from main controller
Definition at line 78 of file uStepperSLite.cpp.
void INT1_vect | ( | void | ) |
Used by dropin feature to take in enable signal.
This interrupt routine is used by the dropin feature to keep track of enable signal from main controller
void TIMER1_COMPA_vect | ( | void | ) |
Measures angle and speed of motor.
This interrupt routine is in charge of sampling the encoder and measure the current speed of the motor.
Definition at line 139 of file uStepperSLite.cpp.
void TIMER3_COMPA_vect | ( | void | ) |
Handles accelerations.
This interrupt routine is in charge of acceleration and deceleration.
Definition at line 125 of file uStepperSLite.cpp.
i2cMaster I2C |
Global definition of I2C object for use in Arduino sketch