supla-device
Loading...
Searching...
No Matches
binary.h
1// SPDX-FileCopyrightText: AC SOFTWARE SP. Z O.O.
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#ifndef SRC_SUPLA_SENSOR_BINARY_H_
5#define SRC_SUPLA_SENSOR_BINARY_H_
6
7#include <supla/io.h>
8#include <supla/sensor/binary_base.h>
9
10namespace Supla {
11
12namespace Io {
13}
14
15namespace Sensor {
16class Binary : public BinaryBase {
17 public:
18 explicit Binary(Supla::Io::IoPin inputPin);
19 explicit Binary(Supla::Io::Base *io,
20 int pin,
21 bool pullUp = false,
22 bool invertLogic = false);
23 explicit Binary(int pin, bool pullUp = false, bool invertLogic = false);
24 bool getValue() override;
25 void onInit() override;
26
27 protected:
28 Supla::Io::IoPin inputPin;
29 bool newStateCandidateValue = false;
30 bool prevValue = false;
31 uint32_t lastStateChangeMs = 0;
32};
33
34}; // namespace Sensor
35}; // namespace Supla
36
37#endif // SRC_SUPLA_SENSOR_BINARY_H_
Definition io.h:23
Definition binary_base.h:35
Definition binary.h:16
void onInit() override
Third method called on element in SuplaDevice.begin()
Definition binary.cpp:49
Definition io_pin.h:14