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

Spindle.h « Tools « src - github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 51c0bad3af4c56fade1d755eb05079b22c4aa94d (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
/*
 * 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;
	float currentRpm, configuredRpm, maxRpm;
	int toolNumber;

public:
	Spindle() noexcept : currentRpm(0.0), configuredRpm(0.0), maxRpm(DefaultMaxSpindleRpm), toolNumber(-1) { }

	bool AllocatePins(GCodeBuffer& gb, const StringRef& reply) noexcept;			// Allocate the pins returning true if successful

	void SetFrequency(PwmFrequency freq) noexcept;

	int GetToolNumber() const noexcept { return toolNumber; }
	void SetToolNumber(int tool) noexcept { toolNumber = tool; }

	void SetMaxRpm(float max) noexcept { maxRpm = max; }

	float GetCurrentRpm() const noexcept { return currentRpm; }
	float GetRpm() const noexcept { return configuredRpm; }
	void SetRpm(float rpm) noexcept;

	void TurnOff() noexcept;
};

#endif