uStepper S
Classes | Macros | Functions | Variables
uStepperS.h File Reference

Function prototypes and definitions for the uStepper S library. More...

#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 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 PID   2
 
#define CLOCKFREQ   16000000.0
 
#define ENCODERINTFREQ   1000.0
 
#define ENCODERINTPERIOD   1.0/ENCODERINTFREQ
 
#define ENCODERSPEEDCONSTANT   ENCODERINTFREQ/65535.0
 
#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
 

Detailed Description

Function prototypes and definitions for the uStepper S library.

        This file contains class and function prototypes for the library,
        as well as necessary constants and global variables.
Author
Thomas Hørring Olsen (thoma.nosp@m.s@us.nosp@m.teppe.nosp@m.r.co.nosp@m.m)

Definition in file uStepperS.h.

Macro Definition Documentation

◆ CCW

#define CCW   0

DESCRIPTION PENDING

Definition at line 132 of file uStepperS.h.

◆ CLOCKFREQ

#define CLOCKFREQ   16000000.0

DESCRIPTION PENDING

Definition at line 208 of file uStepperS.h.

◆ CS_DRIVER

#define CS_DRIVER   PE2

DESCRIPTION PENDING

Definition at line 193 of file uStepperS.h.

◆ CS_ENCODER

#define CS_ENCODER   PD7

DESCRIPTION PENDING

Definition at line 194 of file uStepperS.h.

◆ CW

#define CW   1

DESCRIPTION PENDING

Definition at line 131 of file uStepperS.h.

◆ DROPIN

#define DROPIN   1

Value defining dropin mode for 3d printer/CNC controller boards

Definition at line 204 of file uStepperS.h.

◆ DRV_ENN

#define DRV_ENN   PD4

DESCRIPTION PENDING

Definition at line 189 of file uStepperS.h.

◆ ENCODERINTFREQ

#define ENCODERINTFREQ   1000.0

Frequency at which the encoder is sampled, for keeping track of angle moved and current speed

Definition at line 211 of file uStepperS.h.

◆ ENCODERINTPERIOD

#define ENCODERINTPERIOD   1.0/ENCODERINTFREQ

Frequency at which the encoder is sampled, for keeping track of angle moved and current speed

Definition at line 213 of file uStepperS.h.

◆ ENCODERSPEEDCONSTANT

#define ENCODERSPEEDCONSTANT   ENCODERINTFREQ/65535.0

Constant to convert angle difference between two interrupts to speed in revolutions per second. Dividing by 10 as each speed is calculated from 10 samples

Definition at line 215 of file uStepperS.h.

◆ HARD

#define HARD   0

DESCRIPTION PENDING

Definition at line 186 of file uStepperS.h.

◆ MISO1

#define MISO1   PC0

DESCRIPTION PENDING

Definition at line 198 of file uStepperS.h.

◆ MOSI1

#define MOSI1   PE3

DESCRIPTION PENDING

Definition at line 196 of file uStepperS.h.

◆ MOSI_ENC

#define MOSI_ENC   PC2

DESCRIPTION PENDING

Definition at line 197 of file uStepperS.h.

◆ NORMAL

#define NORMAL   0

Value defining normal mode

Definition at line 202 of file uStepperS.h.

◆ PID

#define PID   2

Value defining PID mode for normal library functions

Definition at line 206 of file uStepperS.h.

◆ POSITION_REACHED

#define POSITION_REACHED   0x20

DESCRIPTION PENDING

Definition at line 134 of file uStepperS.h.

◆ PULSEFILTERKI

#define PULSEFILTERKI   1900.0*ENCODERINTPERIOD

I term in the PI filter estimating the step rate of incomming pulsetrain in DROPIN mode

Definition at line 219 of file uStepperS.h.

◆ PULSEFILTERKP

#define PULSEFILTERKP   120.0

P term in the PI filter estimating the step rate of incomming pulsetrain in DROPIN mode

Definition at line 217 of file uStepperS.h.

◆ SCK1

#define SCK1   PC1

DESCRIPTION PENDING

Definition at line 199 of file uStepperS.h.

◆ SD_MODE

#define SD_MODE   PD5

DESCRIPTION PENDING

Definition at line 190 of file uStepperS.h.

◆ SOFT

#define SOFT   1

DESCRIPTION PENDING

Definition at line 187 of file uStepperS.h.

◆ SPI_MODE

#define SPI_MODE   PD6

DESCRIPTION PENDING

Definition at line 191 of file uStepperS.h.

◆ STALLGUARD2

#define STALLGUARD2   0x04

DESCRIPTION PENDING

Definition at line 137 of file uStepperS.h.

◆ STANDSTILL

#define STANDSTILL   0x08

DESCRIPTION PENDING

Definition at line 136 of file uStepperS.h.

◆ VELOCITY_REACHED

#define VELOCITY_REACHED   0x10

DESCRIPTION PENDING

Definition at line 135 of file uStepperS.h.

Function Documentation

◆ interrupt0()

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 483 of file uStepperS.cpp.

◆ interrupt1()

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 471 of file uStepperS.cpp.

◆ TIMER1_COMPA_vect()

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 518 of file uStepperS.cpp.