supla-device
Loading...
Searching...
No Matches
pin_status_led.h
1/*
2 Copyright (C) AC SOFTWARE SP. Z O.O.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15*/
16
17#ifndef SRC_SUPLA_CONTROL_PIN_STATUS_LED_H_
18#define SRC_SUPLA_CONTROL_PIN_STATUS_LED_H_
19
20#include "../element.h"
21
22namespace Supla {
23
24class Io;
25
26namespace Control {
27class PinStatusLed : public Element {
28 public:
29 PinStatusLed(Supla::Io *ioSrc,
30 Supla::Io *ioOut,
31 uint8_t srcPin,
32 uint8_t outPin,
33 bool invert = false);
34 PinStatusLed(uint8_t srcPin, uint8_t outPin, bool invert = false);
35
36 void onInit() override;
37 void iterateAlways() override;
38 void onTimer() override;
39
40 void setInvertedLogic(bool invertedLogic);
41 void setWorkOnTimer(bool workOnTimer);
42
43 protected:
44 void updatePin();
45
46 uint8_t srcPin = 0;
47 uint8_t outPin = 0;
48 bool invert = false;
49 bool workOnTimer = false;
50 Supla::Io *ioSrc = nullptr;
51 Supla::Io *ioOut = nullptr;
52};
53
54} // namespace Control
55} // namespace Supla
56
57#endif // SRC_SUPLA_CONTROL_PIN_STATUS_LED_H_
void onInit() override
Third method called on element in SuplaDevice.begin()
Definition pin_status_led.cpp:37
void onTimer() override
Method called on timer interupt.
Definition pin_status_led.cpp:48
void iterateAlways() override
Method called on each SuplaDevice iteration.
Definition pin_status_led.cpp:42
Definition io.h:33