#ifndef __TIMED_PIN__H__ #define __TIMED_PIN__H__ #include enum TPinModes { TPM_OFF, // On TPM_ON, // Off TPM_BLINK, // Blink TPM_ASYM, // asymmetric blink TPM_TIMED_ON, // timed on, then off TPM_TIMED_OFF // timed off, then on }; class TimedPin { private: uint8_t PinId; TPinModes PinMode; bool PinState; bool PinInvert; uint32_t RefTime; uint32_t OnTime; uint32_t OffTime; uint16_t CycleCnt; void PinOn(); void PinOff(); public: TimedPin(uint8_t pin, bool inverted = false); void begin(); void loop(); void Blink(uint32_t t_on, uint32_t t_off); void Blink(uint32_t t) { Blink(t, t); } // void BlinkCycles(uint32_t t_on, uint32_t t_off, uint16_t cycles); void Off(); void OffTimed(uint32_t t); void On(); void OnTimed(uint32_t t); }; #endif