diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-04-20 17:39:53 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-04-20 17:39:53 +0300 |
commit | f33d299919ca83729da74d4ebcef48c66d9a007d (patch) | |
tree | 03e39a6a2a0195e6d44bc119a8e5eab34047ebd2 /src/GPIO/GpOutPort.h | |
parent | 669b2fb36307dbb57e3686f1eaa5b12f89f640f9 (diff) |
Changes to PanelDue output code, add GpOut ports to OM
Suppress empty responses to PanelDue
Discard responses that PanelDue indicates that it isn't interested in
Added state.gpOut array
Renamed sensors.inputs to sensors.gpIn and return null array element for
unconfigured inputs
Diffstat (limited to 'src/GPIO/GpOutPort.h')
-rw-r--r-- | src/GPIO/GpOutPort.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/GPIO/GpOutPort.h b/src/GPIO/GpOutPort.h new file mode 100644 index 00000000..fbae879a --- /dev/null +++ b/src/GPIO/GpOutPort.h @@ -0,0 +1,47 @@ +/* + * 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> + +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); + +#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_ */ |