blob: b1e7f3d2f3626e6c59230fb160a72c4d4331568a (
plain)
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
|
/*
* Spindle.h
*
* Created on: Mar 21, 2018
* Author: Christian
*/
#ifndef SPINDLE_H
#define SPINDLE_H
#include "RepRapFirmware.h"
#include "Hardware/IoPorts.h"
class Spindle
{
private:
PwmPort spindleForwardPort, spindleReversePort;
bool inverted;
float currentRpm, configuredRpm, maxRpm;
int toolNumber;
public:
Spindle() : inverted(false), currentRpm(0.0), configuredRpm(0.0), maxRpm(DefaultMaxSpindleRpm), toolNumber(-1) { }
bool SetPins(LogicalPin lpr, LogicalPin lpf, bool invert);
void GetPins(LogicalPin& lpf, LogicalPin& lpr, bool& invert) const;
int GetToolNumber() const { return toolNumber; }
void SetToolNumber(int tool) { toolNumber = tool; }
void SetPwmFrequency(float freq);
void SetMaxRpm(float max) { maxRpm = max; }
float GetCurrentRpm() const { return currentRpm; }
float GetRpm() const { return configuredRpm; }
void SetRpm(float rpm);
void TurnOff();
};
#endif
|