relay: [#9] create relaydevice

This commit is contained in:
Vasily Davydov 2023-05-12 23:59:50 +03:00
parent 2a42371458
commit 1d9e53dc20
2 changed files with 37 additions and 2 deletions

View File

@ -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");
}

View File

@ -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);