diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-05-29 05:44:59 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-05-29 16:31:08 +0300 |
commit | 8b2088103a74e616ca82fe043de55cb7ed58e329 (patch) | |
tree | f8dad8b7bbe9cb6eb135e63cb3ece2338e035aba /platformio/temphum/src/temphum.h | |
parent | 6a64c97c799bd4919b46f8dc39d80799bb751ab3 (diff) |
platformio: split code into libraries
Diffstat (limited to 'platformio/temphum/src/temphum.h')
-rw-r--r-- | platformio/temphum/src/temphum.h | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/platformio/temphum/src/temphum.h b/platformio/temphum/src/temphum.h deleted file mode 100644 index 3d8f373..0000000 --- a/platformio/temphum/src/temphum.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include <Wire.h> - -namespace homekit::temphum { - -struct SensorData { - double temp = 0; // celsius - double rh = 0; // relative humidity percentage -}; - - -class BaseSensor { -protected: - int dev_addr; -public: - explicit BaseSensor(int dev) : dev_addr(dev) {} - void setup() const; - void writeCommand(int reg) const; - virtual SensorData read() = 0; -}; - - -class Si7021 : public BaseSensor { -public: - SensorData read() override; - Si7021() : BaseSensor(0x40) {} -}; - - -class DHT12 : public BaseSensor { -public: - SensorData read() override; - DHT12() : BaseSensor(0x5c) {} -}; - -}
\ No newline at end of file |