-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStepMultiplier.h
42 lines (34 loc) · 970 Bytes
/
StepMultiplier.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
/*
* StepMultiplier.h
*
* Created on: Sep 4, 2014
* Author: bastl
*/
#ifndef STEPMULTIPLIER_H_
#define STEPMULTIPLIER_H_
#include "BastlStepper.h"
class StepMultiplier : public BastlStepper {
public:
StepMultiplier(void (*stepCallback)(), StepSwinger * _swinger, unsigned int timeUnitsPerSecond);
virtual void doStep(unsigned int elapsedTimeUnits);
virtual void update(unsigned int elapsedTimeUnits);
virtual void reset();
void setMultiplication(unsigned char multiplication);
protected:
unsigned int lastStepTimeUnits_;
unsigned int lastSubStepTimeUnits_;
unsigned char multiplication_;
unsigned char stepsLeftToTrigger_;
bool gotSyncStep_;
bool anyStep_;
bool gotStep_;
unsigned char stepsReceived_;
};
inline void StepMultiplier::reset() {
stepsLeftToTrigger_ = 0;
stepsReceived_ = 0;
}
inline void StepMultiplier::setMultiplication(unsigned char multiplication) {
multiplication_ = multiplication;
}
#endif /* STEPMULTIPLIER_H_ */