forked from mirobot/mirobot-arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHotStepper.h
47 lines (40 loc) · 966 Bytes
/
HotStepper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Version 72503c42 from github.com/bjpirt/HotStepper
#ifndef HotStepper_h
#define HotStepper_h
#include "Arduino.h"
#define FORWARD 1
#define BACKWARD 0
#define TIMER1INT 1
#define TIMER2INT 2
#define HOTSTEPPER_TIMER1
class HotStepper {
public:
HotStepper(volatile uint8_t* port, byte offset);
static void setup();
static void setup(char timer);
void instanceSetup();
void turn(long steps, byte direction);
boolean ready();
long remaining();
void release();
static void triggerTop();
void pause();
void resume();
void stop();
private:
static HotStepper *firstInstance;
HotStepper *nextInstance;
void addNext(HotStepper *ref);
boolean _paused;
volatile uint8_t* _port;
byte _pinmask;
volatile long _remaining;
byte _dir;
byte nextStep();
void setStep(byte);
void setNextStep();
void trigger();
byte pad(byte, byte);
byte unpad(byte, byte);
};
#endif