Go to the documentation of this file.
51 this->pointer = _pointer;
55 TCCR1A = (1 << WGM11);
56 TCCR1B = (1 << WGM12) | (1 << WGM13) | (1 << CS10);
72 TIMSK1 = (1 << OCIE1A);
108 if((status & 0xE0) != 0x80)
139 this->
angle = curAngle;
141 deltaAngle = (int32_t)this->
oldAngle - (int32_t)curAngle;
144 if(deltaAngle < -32768)
148 else if(deltaAngle > 32768)
168 return (uint16_t)value;
174 return (
float)
angle * 0.005493164;
Prototype of class for accessing all features of the uStepper S in a single object.
uint16_t getAngleRaw(void)
Return the current shaft angle in raw encoder readings.
int32_t readRegister(uint8_t address)
Reads a register from the motor driver.
volatile int32_t angleMovedRaw
volatile int32_t angleMoved
float getAngleMoved(bool filtered=true)
Returns the angle moved from reference position in degrees.
volatile uint16_t oldAngle
void setSPIMode(uint8_t mode)
uint16_t captureAngle(void)
Capture the current shaft angle.
void setHome(int32_t initialSteps=0)
Resets the internal position counter of the motor driver.
bool detectMagnet(void)
detect magnet
volatile posFilter_t encoderFilter
volatile int32_t smoothValue
float getAngle(void)
Return the current shaft angle in degrees.
#define ENCODERDATATOSTEP
float getRPM(void)
Measure the current speed of the motor.
volatile float speedSmoothValue
int32_t getAngleMovedRaw(bool filtered=true)
Returns the angle moved from reference position in raw encoder readings.
void init(uStepperS *_pointer)
Initiation of the encoder.
uStepperEncoder(void)
Constructor of uStepperEncoder class.
volatile uint16_t encoderOffset
uint8_t getStatus(void)
Get encoder status.
#define ANGLETOENCODERDATA
void setHome(float initialAngle=0)
Define new reference(home) position.
uint8_t SPI(uint8_t data)
float getSpeed(void)
Measure the current speed of the motor.
void chipSelect(bool state)
Set the output level of the chip select pin.
#define ENCODERDATATOREVOLUTIONS