Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Spindle.h « src - github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5e05993cf08bff1911adedc1de2db2a905f856a7 (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 "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