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

PortControl.h « src - github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bc0b6cce6d4e6c9067a73d700400e82928bd20ff (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
42
43
/*
 * PortControl.h
 *
 *  Created on: 15 Jun 2017
 *      Author: David
 */

#ifndef SRC_PORTCONTROL_H_
#define SRC_PORTCONTROL_H_

#include "RepRapFirmware.h"
#include "IoPorts.h"			// for PinConfiguration

class GCodeBuffer;

#if SUPPORT_IOBITS

typedef uint16_t IoBits_t;

class PortControl
{
public:
	PortControl();
	void Init();
	void Exit();
	void Spin(bool full);
	bool Configure(GCodeBuffer& gb, const StringRef& reply);

private:
	void UpdatePorts(IoBits_t newPortState);

	static const size_t MaxPorts = 16;		// the port bitmap is currently a 16-bit word

	IoPort portMap[MaxPorts];
	size_t numConfiguredPorts;
	unsigned int advanceMillis;
	uint32_t advanceClocks;
	IoBits_t currentPortState;
};

#endif

#endif /* SRC_PORTCONTROL_H_ */