2023-07-20 10:06:31 -04:00
|
|
|
#pragma once
|
|
|
|
//
|
|
|
|
// FILE: SHT31_SWW.h
|
|
|
|
// AUTHOR: Rob Tillaart, Gunter Haug
|
2023-12-09 13:55:11 -05:00
|
|
|
// VERSION: 0.2.0
|
2023-07-20 10:06:31 -04:00
|
|
|
// DATE: 2019-02-08 (base SHT31 lib)
|
|
|
|
// PURPOSE: Arduino library for the SHT31 temperature and humidity sensor
|
|
|
|
// to be used with the SoftwareWire library instead of (hardware) Wire.
|
|
|
|
// derives from SHT31 0.3.8
|
2023-07-23 08:19:03 -04:00
|
|
|
// URL: https://www.adafruit.com/product/2857
|
|
|
|
// https://github.com/RobTillaart/SHT31_SWW
|
|
|
|
// https://github.com/RobTillaart/SHT31
|
2023-07-20 10:06:31 -04:00
|
|
|
|
|
|
|
|
|
|
|
#include "Arduino.h"
|
|
|
|
#include "SoftwareWire.h"
|
|
|
|
#include "SHT31.h"
|
|
|
|
|
|
|
|
|
2023-12-09 13:55:11 -05:00
|
|
|
#define SHT31_SWW_LIB_VERSION (F("0.2.0"))
|
2023-07-20 10:06:31 -04:00
|
|
|
|
|
|
|
|
|
|
|
class SHT31_SWW : public SHT31
|
|
|
|
{
|
|
|
|
public:
|
2023-12-09 13:55:11 -05:00
|
|
|
SHT31_SWW(uint8_t address, SoftwareWire *wire);
|
2023-07-20 10:06:31 -04:00
|
|
|
|
2023-12-09 13:55:11 -05:00
|
|
|
bool begin();
|
2023-07-20 10:06:31 -04:00
|
|
|
|
|
|
|
// check sensor is reachable over I2C
|
|
|
|
bool isConnected();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool writeCmd(uint16_t cmd);
|
|
|
|
bool readBytes(uint8_t n, uint8_t *val);
|
2023-07-23 08:19:03 -04:00
|
|
|
SoftwareWire* _softwareWire;
|
2023-07-20 10:06:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// -- END OF FILE --
|
|
|
|
|