mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.5.0 SHT85
This commit is contained in:
parent
64cca7e6d6
commit
b83d5eba75
@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
|
||||||
|
## [0.5.0] - 2023-09-21
|
||||||
|
- fix #21, support Wire1 for ESP32
|
||||||
|
- move TwoWire selection to constructor.
|
||||||
|
- update readme.md
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## [0.4.2] - 2023-09-05
|
## [0.4.2] - 2023-09-05
|
||||||
- fix #19 SHT85 cannot be address 0x45
|
- fix #19 SHT85 cannot be address 0x45
|
||||||
- rewrote begin()
|
- rewrote begin()
|
||||||
@ -15,7 +22,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- redo badges in readme.md
|
- redo badges in readme.md
|
||||||
- minor edits
|
- minor edits
|
||||||
|
|
||||||
|
|
||||||
## [0.4.1] - 2022-05-09
|
## [0.4.1] - 2022-05-09
|
||||||
- add **uint32_t getSerialNumber()** for SHT85 (no CRC check).
|
- add **uint32_t getSerialNumber()** for SHT85 (no CRC check).
|
||||||
- improve error handling.
|
- improve error handling.
|
||||||
|
@ -120,21 +120,20 @@ I2C multiplexer
|
|||||||
|
|
||||||
#### Base interface
|
#### Base interface
|
||||||
|
|
||||||
- **SHT()** constructor of the base class. **getType()** will return 0.
|
- **SHT(TwoWire \*wire = &Wire)** constructor of the base class. **getType()** will return 0.
|
||||||
- **SHT30()** constructor.
|
- **SHT30(TwoWire \*wire = &Wire)** constructor. Optional select the I2C bus (Wire, Wire1 etc).
|
||||||
- **SHT31()** constructor.
|
- **SHT31(TwoWire \*wire = &Wire)** constructor. Optional select the I2C bus (Wire, Wire1 etc).
|
||||||
- **SHT35()** constructor.
|
- **SHT35(TwoWire \*wire = &Wire)** constructor. Optional select the I2C bus (Wire, Wire1 etc).
|
||||||
- **SHT85()** constructor.
|
- **SHT85(TwoWire \*wire = &Wire)** constructor. Optional select the I2C bus (Wire, Wire1 etc).
|
||||||
- **uint8_t getType()** returns numeric part of sensor type.
|
- **uint8_t getType()** returns numeric part of sensor type.
|
||||||
Returns 0 for the base class.
|
Returns 0 for the base class.
|
||||||
- **bool begin(uint8_t address, uint8_t dataPin, uint8_t clockPin)** begin function for ESP8266, ESP32 and similar. **WARNING: not verified yet**.
|
- **bool begin(uint8_t address, uint8_t dataPin, uint8_t clockPin)** begin function for ESP8266, ESP32 and similar.
|
||||||
|
**WARNING: not verified yet**.
|
||||||
Returns false if device address is incorrect or device cannot be reset.
|
Returns false if device address is incorrect or device cannot be reset.
|
||||||
- **bool begin(uint8_t dataPin, uint8_t clockPin)** same as above.
|
- **bool begin(uint8_t dataPin, uint8_t clockPin)** same as above.
|
||||||
Uses SHT_DEFAULT_ADDRESS (0x44) as address.
|
Uses SHT_DEFAULT_ADDRESS (0x44) as address.
|
||||||
- **bool begin(uint8_t address, TwoWire \*wire = &Wire)** for platforms with multiple I2C buses. The default I2C bus is Wire.
|
- **bool begin(uint8_t address = SHT_DEFAULT_ADDRESS)**
|
||||||
Returns false if device address is incorrect or device cannot be reset.
|
Returns false if device address is incorrect or device cannot be reset.
|
||||||
- **bool begin(TwoWire \*wire = &Wire)** same as above.
|
|
||||||
Uses SHT_DEFAULT_ADDRESS (0x44) as address.
|
|
||||||
|
|
||||||
|
|
||||||
#### Status
|
#### Status
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// FILE: SHT85.cpp
|
// FILE: SHT85.cpp
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.4.2
|
// VERSION: 0.5.0
|
||||||
// DATE: 2021-02-10
|
// DATE: 2021-02-10
|
||||||
// PURPOSE: Arduino library for the SHT85 temperature and humidity sensor
|
// PURPOSE: Arduino library for the SHT85 temperature and humidity sensor
|
||||||
// https://nl.rs-online.com/web/p/temperature-humidity-sensor-ics/1826530
|
// https://nl.rs-online.com/web/p/temperature-humidity-sensor-ics/1826530
|
||||||
@ -29,10 +29,10 @@
|
|||||||
#define SHT_GET_SERIAL 0x3682
|
#define SHT_GET_SERIAL 0x3682
|
||||||
|
|
||||||
|
|
||||||
SHT::SHT()
|
SHT::SHT(TwoWire *wire)
|
||||||
{
|
{
|
||||||
_address = 0;
|
_address = 0;
|
||||||
_wire = NULL;
|
_wire = wire;
|
||||||
_lastRead = 0;
|
_lastRead = 0;
|
||||||
_rawTemperature = 0;
|
_rawTemperature = 0;
|
||||||
_rawHumidity = 0;
|
_rawHumidity = 0;
|
||||||
@ -74,25 +74,18 @@ bool SHT::begin(const uint8_t dataPin, const uint8_t clockPin)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool SHT::begin(const uint8_t address, TwoWire *wire)
|
bool SHT::begin(const uint8_t address)
|
||||||
{
|
{
|
||||||
if ((address != 0x44) && (address != 0x45))
|
if ((address != 0x44) && (address != 0x45))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_address = address;
|
_address = address;
|
||||||
_wire = wire;
|
|
||||||
_wire->begin();
|
_wire->begin();
|
||||||
return reset();
|
return reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SHT::begin(TwoWire *wire)
|
|
||||||
{
|
|
||||||
return begin(SHT_DEFAULT_ADDRESS, wire);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t SHT::getType()
|
uint8_t SHT::getType()
|
||||||
{
|
{
|
||||||
return _type;
|
return _type;
|
||||||
@ -461,25 +454,25 @@ bool SHT::readBytes(uint8_t n, uint8_t *val)
|
|||||||
//
|
//
|
||||||
// DERIVED CLASSES
|
// DERIVED CLASSES
|
||||||
//
|
//
|
||||||
SHT30::SHT30()
|
SHT30::SHT30(TwoWire *wire) : SHT(wire)
|
||||||
{
|
{
|
||||||
_type = 30;
|
_type = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SHT31::SHT31()
|
SHT31::SHT31(TwoWire *wire) : SHT(wire)
|
||||||
{
|
{
|
||||||
_type = 31;
|
_type = 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SHT35::SHT35()
|
SHT35::SHT35(TwoWire *wire) : SHT(wire)
|
||||||
{
|
{
|
||||||
_type = 35;
|
_type = 35;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SHT85::SHT85()
|
SHT85::SHT85(TwoWire *wire) : SHT(wire)
|
||||||
{
|
{
|
||||||
_type = 85;
|
_type = 85;
|
||||||
}
|
}
|
||||||
@ -493,10 +486,10 @@ bool SHT85::begin(const uint8_t address, uint8_t dataPin, uint8_t clockPin)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool SHT85::begin(const uint8_t address, TwoWire *wire)
|
bool SHT85::begin(const uint8_t address)
|
||||||
{
|
{
|
||||||
if (address != 0x44) return false;
|
if (address != 0x44) return false;
|
||||||
return SHT::begin(address, wire);
|
return SHT::begin(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// FILE: SHT85.h
|
// FILE: SHT85.h
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.4.2
|
// VERSION: 0.5.0
|
||||||
// DATE: 2021-02-10
|
// DATE: 2021-02-10
|
||||||
// PURPOSE: Arduino library for the SHT85 temperature and humidity sensor
|
// PURPOSE: Arduino library for the SHT85 temperature and humidity sensor
|
||||||
// https://nl.rs-online.com/web/p/temperature-humidity-sensor-ics/1826530
|
// https://nl.rs-online.com/web/p/temperature-humidity-sensor-ics/1826530
|
||||||
@ -25,7 +25,7 @@
|
|||||||
#include "Wire.h"
|
#include "Wire.h"
|
||||||
|
|
||||||
|
|
||||||
#define SHT_LIB_VERSION (F("0.4.2"))
|
#define SHT_LIB_VERSION (F("0.5.0"))
|
||||||
#define SHT85_LIB_VERSION SHT_LIB_VERSION
|
#define SHT85_LIB_VERSION SHT_LIB_VERSION
|
||||||
|
|
||||||
#ifndef SHT_DEFAULT_ADDRESS
|
#ifndef SHT_DEFAULT_ADDRESS
|
||||||
@ -58,7 +58,7 @@
|
|||||||
class SHT
|
class SHT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SHT();
|
SHT(TwoWire *wire = &Wire);
|
||||||
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
bool begin(const uint8_t address, uint8_t dataPin, uint8_t clockPin);
|
bool begin(const uint8_t address, uint8_t dataPin, uint8_t clockPin);
|
||||||
@ -66,9 +66,7 @@ public:
|
|||||||
bool begin(const uint8_t dataPin, const uint8_t clockPin);
|
bool begin(const uint8_t dataPin, const uint8_t clockPin);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool begin(const uint8_t address, TwoWire *wire = &Wire);
|
bool begin(const uint8_t address = SHT_DEFAULT_ADDRESS);
|
||||||
// use SHT_DEFAULT_ADDRESS
|
|
||||||
bool begin(TwoWire *wire = &Wire);
|
|
||||||
|
|
||||||
uint8_t getType();
|
uint8_t getType();
|
||||||
|
|
||||||
@ -162,34 +160,34 @@ protected:
|
|||||||
class SHT30 : public SHT
|
class SHT30 : public SHT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SHT30();
|
SHT30(TwoWire *wire = &Wire);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SHT31 : public SHT
|
class SHT31 : public SHT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SHT31();
|
SHT31(TwoWire *wire = &Wire);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SHT35 : public SHT
|
class SHT35 : public SHT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SHT35();
|
SHT35(TwoWire *wire = &Wire);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SHT85 : public SHT
|
class SHT85 : public SHT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SHT85();
|
SHT85(TwoWire *wire = &Wire);
|
||||||
|
|
||||||
// catch incorrect calls with an address, only 0x44 allowed, see #19
|
// catch incorrect calls with an address, only 0x44 allowed, see #19
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
bool begin(const uint8_t address, uint8_t dataPin, uint8_t clockPin);
|
bool begin(const uint8_t address, uint8_t dataPin, uint8_t clockPin);
|
||||||
#endif
|
#endif
|
||||||
bool begin(const uint8_t address, TwoWire *wire = &Wire);
|
bool begin(const uint8_t address = SHT_DEFAULT_ADDRESS);
|
||||||
|
|
||||||
// EXPERIMENTAL for 0.4.1
|
// EXPERIMENTAL for 0.4.1
|
||||||
uint32_t GetSerialNumber();
|
uint32_t GetSerialNumber();
|
||||||
|
@ -23,6 +23,7 @@ uint32_t stop;
|
|||||||
uint16_t count = 0;
|
uint16_t count = 0;
|
||||||
uint32_t last = 0;
|
uint32_t last = 0;
|
||||||
|
|
||||||
|
// SHT85 sht(&Wire1);
|
||||||
SHT85 sht;
|
SHT85 sht;
|
||||||
|
|
||||||
|
|
||||||
@ -67,5 +68,3 @@ void loop()
|
|||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/SHT85"
|
"url": "https://github.com/RobTillaart/SHT85"
|
||||||
},
|
},
|
||||||
"version": "0.4.2",
|
"version": "0.5.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "arduino",
|
"frameworks": "*",
|
||||||
"platforms": "*",
|
"platforms": "*",
|
||||||
"headers": "SHT85.h"
|
"headers": "SHT85.h"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=SHT85
|
name=SHT85
|
||||||
version=0.4.2
|
version=0.5.0
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Arduino library for the SHT85, SHT30, SHT31, SHT35 Senserion temperature and humidity sensors and compatibles.
|
sentence=Arduino library for the SHT85, SHT30, SHT31, SHT35 Senserion temperature and humidity sensors and compatibles.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user