supla-device
Loading...
Searching...
No Matches
Si7021_sonoff.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_SI7021_SONOFF_H_
5#define SRC_SUPLA_SENSOR_SI7021_SONOFF_H_
6
7#include <Arduino.h>
8#include <supla/sensor/therm_hygro_meter.h>
9
10namespace Supla {
11namespace Sensor {
13 public:
14 explicit Si7021Sonoff(int pin);
15 double getTemp();
16 double getHumi();
17
18 private:
19 void iterateAlways();
20 void onInit();
21 double readTemp(uint8_t* data);
22 double readHumi(uint8_t* data);
23 void read();
24 bool waitState(bool state);
25
26 protected:
27 int8_t pin;
28 double temperature;
29 double humidity;
30 int8_t retryCount;
31};
32
33}; // namespace Sensor
34}; // namespace Supla
35
36#endif // SRC_SUPLA_SENSOR_SI7021_SONOFF_H_
Definition Si7021_sonoff.h:12
Definition therm_hygro_meter.h:14