uStepper S
|
#include <avr/io.h>
#include <avr/interrupt.h>
#include <Arduino.h>
#include <EEPROM.h>
#include <inttypes.h>
#include <uStepperServo.h>
#include <uStepperEncoder.h>
#include <uStepperDriver.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... | |
struct | posFilter_t |
Struct for encoder velocity estimator. More... | |
class | uStepperS |
Prototype of class for accessing all features of the uStepper S in a single object. More... | |
Macros | |
#define | FREEWHEELBRAKE 0 |
#define | COOLBRAKE 1 |
#define | HARDBRAKE 2 |
#define | CW 1 |
#define | CCW 0 |
#define | POSITION_REACHED 0x20 |
#define | VELOCITY_REACHED 0x10 |
#define | STANDSTILL 0x08 |
#define | STALLGUARD2 0x04 |
#define | HARD 0 |
#define | SOFT 1 |
#define | DRV_ENN PD4 |
#define | SD_MODE PD5 |
#define | SPI_MODE PD6 |
#define | CS_DRIVER PE2 |
#define | CS_ENCODER PD7 |
#define | MOSI1 PE3 |
#define | MOSI_ENC PC2 |
#define | MISO1 PC0 |
#define | SCK1 PC1 |
#define | NORMAL 0 |
#define | DROPIN 1 |
#define | CLOSEDLOOP 2 |
#define | PID CLOSEDLOOP |
#define | CLOCKFREQ 16000000.0 |
#define | ENCODERINTFREQ 1000 |
#define | ENCODERINTPERIOD 1.0/ENCODERINTFREQ |
#define | PULSEFILTERKP 120.0 |
#define | PULSEFILTERKI 1900.0*ENCODERINTPERIOD |
Functions | |
void | TIMER1_COMPA_vect (void) __attribute__((signal |
Interrupt routine for critical tasks. More... | |
void | interrupt0 (void) |
Used by dropin feature to take in step pulses. More... | |
void | interrupt1 (void) |
Used by dropin feature to take in enable signal. More... | |
Variables | |
void | used |
#define CCW 0 |
Define label users can use as argument for runContinous() function to specify counterclockwise direction
Definition at line 155 of file uStepperS.h.
#define CLOCKFREQ 16000000.0 |
MCU Clock frequency
Definition at line 230 of file uStepperS.h.
#define CLOSEDLOOP 2 |
Value defining closed loop mode for normal library functions
Definition at line 227 of file uStepperS.h.
#define COOLBRAKE 1 |
Define label users can use as argument for setBrakeMode() function to make the motor brake by shorting the two bottom FET's of the H-Bridge. This will provide less holding torque, but will significantly reduce driver heat
Definition at line 151 of file uStepperS.h.
#define CS_DRIVER PE2 |
Define label for driver chip select pin. Not normally needed for users
Definition at line 216 of file uStepperS.h.
#define CS_ENCODER PD7 |
Define label for encoder chip select pin. Not normally needed for users
Definition at line 217 of file uStepperS.h.
#define CW 1 |
Define label users can use as argument for runContinous() function to specify clockwise direction
Definition at line 154 of file uStepperS.h.
#define DROPIN 1 |
Value defining dropin mode for 3d printer/CNC controller boards
Definition at line 226 of file uStepperS.h.
#define DRV_ENN PD4 |
Define label for driver DRV_ENN pin. Not normally needed for users
Definition at line 212 of file uStepperS.h.
#define ENCODERINTFREQ 1000 |
Frequency at which the encoder is sampled, for keeping track of angle moved and current speed Frequency is 1kHz in dropin and 2kHz for all other modes. base define is 1kHz, and if the mode is not dropin, it is multiplied by 2 in the relevant places of the code
Definition at line 236 of file uStepperS.h.
#define ENCODERINTPERIOD 1.0/ENCODERINTFREQ |
Frequency at which the encoder is sampled, for keeping track of angle moved and current speed
Definition at line 237 of file uStepperS.h.
#define FREEWHEELBRAKE 0 |
Define label users can use as argument for setBrakeMode() function to specify freewheeling as brake mode. This will result in no holding torque at standstill
Definition at line 150 of file uStepperS.h.
#define HARD 0 |
Define label users can use as argument for stop() function to specify that the motor should stop immediately (without decelerating)
Definition at line 209 of file uStepperS.h.
#define HARDBRAKE 2 |
Define label users can use as argument for setBrakeMode() function to use full specified current for braking. This will provide high holding torque, but will make the driver (and motor) dissipate power
Definition at line 152 of file uStepperS.h.
#define MISO1 PC0 |
Define label for driver chip MISO pin. Not normally needed for users
Definition at line 221 of file uStepperS.h.
#define MOSI1 PE3 |
Define label for driver chip MOSI pin. Not normally needed for users
Definition at line 219 of file uStepperS.h.
#define MOSI_ENC PC2 |
Define label for encoder chip MOSI pin. Not normally needed for users
Definition at line 220 of file uStepperS.h.
#define NORMAL 0 |
Value defining normal mode
Definition at line 225 of file uStepperS.h.
#define PID CLOSEDLOOP |
Value defining PID mode for normal library functions. only here for backwards compatibility
Definition at line 228 of file uStepperS.h.
#define POSITION_REACHED 0x20 |
Define label users can use as argument for getMotorState() function to check if target position has been reached
Definition at line 157 of file uStepperS.h.
#define PULSEFILTERKI 1900.0*ENCODERINTPERIOD |
I term in the PI filter estimating the step rate of incomming pulsetrain in DROPIN mode
Definition at line 239 of file uStepperS.h.
#define PULSEFILTERKP 120.0 |
P term in the PI filter estimating the step rate of incomming pulsetrain in DROPIN mode
Definition at line 238 of file uStepperS.h.
#define SCK1 PC1 |
Define label for driver chip SCK pin. Not normally needed for users
Definition at line 222 of file uStepperS.h.
#define SD_MODE PD5 |
Define label for driver chip SD_MODE pin. Not normally needed for users
Definition at line 213 of file uStepperS.h.
#define SOFT 1 |
Define label users can use as argument for stop() function to specify that the motor should decelerate before stopping
Definition at line 210 of file uStepperS.h.
#define SPI_MODE PD6 |
Define label for driver SPI_MODE pin. Not normally needed for users
Definition at line 214 of file uStepperS.h.
#define STALLGUARD2 0x04 |
Define label users can use as argument for getMotorState() function to check stallguard status
Definition at line 160 of file uStepperS.h.
#define STANDSTILL 0x08 |
Define label users can use as argument for getMotorState() function to check if motor is not currently running
Definition at line 159 of file uStepperS.h.
#define VELOCITY_REACHED 0x10 |
Define label users can use as argument for getMotorState() function to check if target velocity has been reached
Definition at line 158 of file uStepperS.h.
void interrupt0 | ( | 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 539 of file uStepperS.cpp.
void interrupt1 | ( | 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
Definition at line 527 of file uStepperS.cpp.
void TIMER1_COMPA_vect | ( | void | ) |
Interrupt routine for critical tasks.
This interrupt routine is in charge of sampling the encoder, process the data and handle PID
Definition at line 574 of file uStepperS.cpp.
void used |
Definition at line 246 of file uStepperS.h.