/***************************************************************************** source::worx libPiGPio Copyright © 2022 c.holzheuer chris@sourceworx.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Uses: pigpiod_if2 by joan2937, pigpio @ abyz.me.uk https://abyz.me.uk/rpi/pigpio sigslot by 2017 Pierre-Antoine Lacaze https://github.com/palacaze/sigslot ***************************************************************************/ #ifndef PIGTIMER_H #define PIGTIMER_H #include #include class LIBPIGPIO_EXPORT pigTimer : public pigState { public: pigTimer(); pigTimer( int timeOn, int timeOff = 0, int repcnt = -1 ); virtual ~pigTimer(); void change_state( bool newState ) override; int timeOn(); void setTimeOn( int timeOn ); int timeOff(); void setTimeOff( int timeOff ); void setRepetitions( int repcnt ); int repetitions(); void start(); void stop(); protected: void sleepCycle(); void sleepThread( int delay ); int _timeOn = 0; int _timeOff = 0; bool _active = false; int _repcnt = -1; int _count = 0; }; #endif // PIGTIMER_H