blob: cf90a9ea0826f91f71462014e963a746f19f6ded (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/*
* GpOutPort.h
*
* Created on: 11 Feb 2020
* Author: David
*/
#ifndef SRC_GPIO_GPOUTPORT_H_
#define SRC_GPIO_GPOUTPORT_H_
#include <RepRapFirmware.h>
#include <Hardware/IoPorts.h>
#include <GCodes/GCodeResult.h>
#include <ObjectModel/ObjectModel.h>
#if SUPPORT_REMOTE_COMMANDS
class CanMessageGenericParser;
#endif
class GpOutputPort INHERIT_OBJECT_MODEL
{
public:
GpOutputPort() noexcept
: lastPwm(0.0)
#if SUPPORT_CAN_EXPANSION
, boardAddress(CanId::MasterAddress)
#endif
{ }
GpOutputPort(const GpOutputPort&) = delete;
bool IsUnused() const noexcept;
GCodeResult WriteAnalog(uint32_t gpioPortNumber, bool isServo, float pwm, const GCodeBuffer& gb, const StringRef& reply) noexcept;
GCodeResult Configure(uint32_t gpioNumber, bool isServo, GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException);
#if SUPPORT_REMOTE_COMMANDS
GCodeResult AssignFromRemote(uint32_t gpioPortNumber, const CanMessageGenericParser& parser, const StringRef& reply) noexcept;
void WriteAnalog(float pwm) noexcept;
#endif
#ifdef PCCB
void Assign(const char *pinName) noexcept;
#endif
protected:
DECLARE_OBJECT_MODEL
private:
PwmPort port; // will be initialised by PwmPort default constructor
float lastPwm;
#if SUPPORT_CAN_EXPANSION
CanAddress boardAddress;
#endif
};
#endif /* SRC_GPIO_GPOUTPORT_H_ */
|