supla-device
Loading...
Searching...
No Matches
pin_status_led.h
1// SPDX-FileCopyrightText: AC SOFTWARE SP. Z O.O.
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#ifndef SRC_SUPLA_CONTROL_PIN_STATUS_LED_H_
5#define SRC_SUPLA_CONTROL_PIN_STATUS_LED_H_
6
7#include "../element.h"
8#include "../io.h"
9
10namespace Supla {
11
12namespace Io {
13class Base;
14}
15
16namespace Control {
17class PinStatusLed : public Element {
18 public:
19 explicit PinStatusLed(Supla::Io::IoPin srcPin, Supla::Io::IoPin outPin);
20 explicit PinStatusLed(Supla::Io::IoPin srcPin,
21 Supla::Io::IoPin outPin,
22 bool invert);
24 Supla::Io::Base *ioOut,
25 uint8_t srcPin,
26 uint8_t outPin,
27 bool invert = false);
28 PinStatusLed(uint8_t srcPin, uint8_t outPin, bool invert = false);
29
30 void onInit() override;
31 void iterateAlways() override;
32 void onTimer() override;
33
34 void setInvertedLogic(bool invertedLogic);
35 void setWorkOnTimer(bool workOnTimer);
36
37 protected:
38 void updatePin();
39
40 Supla::Io::IoPin srcPin;
41 Supla::Io::IoPin outPin;
42 bool workOnTimer = false;
43};
44
45} // namespace Control
46} // namespace Supla
47
48#endif // SRC_SUPLA_CONTROL_PIN_STATUS_LED_H_
Definition pin_status_led.h:17
void onInit() override
Third method called on element in SuplaDevice.begin()
Definition pin_status_led.cpp:38
void onTimer() override
Method called on timer interupt.
Definition pin_status_led.cpp:49
void iterateAlways() override
Method called on each SuplaDevice iteration.
Definition pin_status_led.cpp:43
Base class for all elements of SuplaDevice.
Definition element.h:27
Definition io.h:23
Definition io_pin.h:14