2018-07-19 06:26:31 -07:00
|
|
|
#ifndef CRANKMATHS_H
|
|
|
|
#define CRANKMATHS_H
|
|
|
|
|
2018-07-12 03:45:27 -07:00
|
|
|
#define CRANKMATH_METHOD_INTERVAL_DEFAULT 0
|
|
|
|
#define CRANKMATH_METHOD_INTERVAL_REV 1
|
|
|
|
#define CRANKMATH_METHOD_INTERVAL_TOOTH 2
|
|
|
|
#define CRANKMATH_METHOD_ALPHA_BETA 3
|
|
|
|
#define CRANKMATH_METHOD_2ND_DERIVATIVE 4
|
2018-06-29 16:21:13 -07:00
|
|
|
|
2018-07-12 03:45:27 -07:00
|
|
|
#define fastDegreesToUS(degrees) (degrees * (unsigned long)timePerDegree)
|
|
|
|
|
2018-07-19 06:26:31 -07:00
|
|
|
unsigned long angleToTime(int16_t, byte);
|
|
|
|
uint16_t timeToAngle(unsigned long, byte);
|
2018-07-12 03:45:27 -07:00
|
|
|
|
|
|
|
volatile int timePerDegree;
|
2018-07-19 06:26:31 -07:00
|
|
|
volatile uint16_t degreesPeruSx2048;
|
|
|
|
|
|
|
|
#endif
|