diff --git a/source/shoh/src/threads/relay/Relay.cpp b/source/shoh/src/threads/relay/Relay.cpp index 78cc214..5022f79 100644 --- a/source/shoh/src/threads/relay/Relay.cpp +++ b/source/shoh/src/threads/relay/Relay.cpp @@ -9,11 +9,30 @@ #include "Event.h" #include "Log.h" -Relay::Relay(ThreadCommon::QueueManager* qm): _qm(qm) { +RelayDevice::RelayDevice(uint8_t en_pin, + uint8_t en_port, + uint8_t pha_pin, + uint8_t pha_port, + uint8_t relay_device_index + ) +{ + en = new DigitalIoPin(en_pin, en_port, false); + pha = new DigitalIoPin(pha_pin, pha_port, false); + LOG_DEBUG("Creating RelayDevice"); +} + +RelayDevice::~RelayDevice() +{ + LOG_ERROR("Deleting RelayDevice"); +} + +Relay::Relay(ThreadCommon::QueueManager* qm): _qm(qm) +{ LOG_DEBUG("Creating Relay"); } -Relay::~Relay() { +Relay::~Relay() +{ LOG_ERROR("Deleting Relay"); } diff --git a/source/shoh/src/threads/relay/Relay.h b/source/shoh/src/threads/relay/Relay.h index 1678d06..7065174 100644 --- a/source/shoh/src/threads/relay/Relay.h +++ b/source/shoh/src/threads/relay/Relay.h @@ -9,6 +9,20 @@ #define THREADS_RELAY_RELAY_H_ #include "ThreadCommon.h" +#include "DigitalIoPin.h" + +class RelayDevice { + public: + RelayDevice(uint8_t en_pin, + uint8_t en_port, + uint8_t pha_pin, + uint8_t pha_port, + uint8_t relay_device_index); + virtual ~RelayDevice(); + private: + DigitalIoPin * en; + DigitalIoPin * pha; +}; class Relay { public: @@ -17,6 +31,8 @@ public: void taskFunction(); private: ThreadCommon::QueueManager* _qm; + RelayDevice relays [2] = {{0, 23, 0, 24, 0}, + {0, 25, 0, 26, 1}}; }; void thread_relay(void * pvParams);