//
//    FILE: Relays.h
// VERSION: 1.0
// PURPOSE: Handle two relays used to toggle voltage polarity to control a clock
//
//

#ifndef _relaysLoaded
#define _relaysLoaded true

#include <Arduino.h>

class Relays {
public:
  Relays():holdTime_ms(200), minOffTime_ms(100), fastforwardMode(false) {};
  void begin(int _relay1Pin, int _relay2Pin);
  void toggle();
  void off();
  void loop();
  void setHoldTime_ms(unsigned int newValue) { holdTime_ms = newValue; }
  void setMinOffTime_ms(unsigned int newValue) { minOffTime_ms = newValue; }
  unsigned int getHoldTime_ms() { return holdTime_ms; }
  unsigned int getMinOffTime_ms() { return minOffTime_ms; }
  void setDisplayedTime(unsigned int h, unsigned int m) { displayedTime_hours = h; displayedTime_minutes = m; }
  unsigned int getDisplayedTime_hours() { return displayedTime_hours; }
  unsigned int getDisplayedTime_minutes() { return displayedTime_minutes; }
  void fwdToTime(unsigned int hours, unsigned int minutes);
protected:
  int relay1Pin, relay2Pin;
  unsigned int holdTime_ms;
  unsigned int minOffTime_ms;
  unsigned int displayedTime_hours;
  unsigned int displayedTime_minutes;
  unsigned int targetHours;
  unsigned int targetMinutes;
  boolean fastforwardMode;

};

#endif
